Package discoveryengine is an auto-generated package for the Discovery Engine API.
Discovery Engine API.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
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/discoveryengine/apiv1alpha@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 := discoveryengine.NewAclConfigClient(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 := &discoveryenginepb.GetAclConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetAclConfigRequest. } resp, err := c.GetAclConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewAclConfigClient 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.
AclConfigCallOptions
type AclConfigCallOptions struct { UpdateAclConfig []gax.CallOption GetAclConfig []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }AclConfigCallOptions contains the retry settings for each method of AclConfigClient.
AclConfigClient
type AclConfigClient struct { // The call options for this service. CallOptions *AclConfigCallOptions // contains filtered or unexported fields }AclConfigClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing Acl Configuration.
func NewAclConfigClient
func NewAclConfigClient(ctx context.Context, opts ...option.ClientOption) (*AclConfigClient, error)NewAclConfigClient creates a new acl config service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Acl Configuration.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewAclConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewAclConfigRESTClient
func NewAclConfigRESTClient(ctx context.Context, opts ...option.ClientOption) (*AclConfigClient, error)NewAclConfigRESTClient creates a new acl config service rest client.
Service for managing Acl Configuration.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewAclConfigRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*AclConfigClient) CancelOperation
func (c *AclConfigClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewAclConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*AclConfigClient) Close
func (c *AclConfigClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*AclConfigClient) Connection (deprecated)
func (c *AclConfigClient) 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 (*AclConfigClient) GetAclConfig
func (c *AclConfigClient) GetAclConfig(ctx context.Context, req *discoveryenginepb.GetAclConfigRequest, opts ...gax.CallOption) (*discoveryenginepb.AclConfig, error)GetAclConfig gets the AclConfig.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewAclConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetAclConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetAclConfigRequest. } resp, err := c.GetAclConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*AclConfigClient) GetOperation
func (c *AclConfigClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewAclConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*AclConfigClient) ListOperations
func (c *AclConfigClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewAclConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewAclConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*AclConfigClient) UpdateAclConfig
func (c *AclConfigClient) UpdateAclConfig(ctx context.Context, req *discoveryenginepb.UpdateAclConfigRequest, opts ...gax.CallOption) (*discoveryenginepb.AclConfig, error)UpdateAclConfig default ACL configuration for use in a location of a customer’s project. Updates will only reflect to new data stores. Existing data stores will still use the old value.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewAclConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateAclConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateAclConfigRequest. } resp, err := c.UpdateAclConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } BatchCreateTargetSitesOperation
type BatchCreateTargetSitesOperation struct { // contains filtered or unexported fields }BatchCreateTargetSitesOperation manages a long-running operation from BatchCreateTargetSites.
func (*BatchCreateTargetSitesOperation) Done
func (op *BatchCreateTargetSitesOperation) Done() boolDone reports whether the long-running operation has completed.
func (*BatchCreateTargetSitesOperation) Metadata
func (op *BatchCreateTargetSitesOperation) Metadata() (*discoveryenginepb.BatchCreateTargetSiteMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchCreateTargetSitesOperation) Name
func (op *BatchCreateTargetSitesOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchCreateTargetSitesOperation) Poll
func (op *BatchCreateTargetSitesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.BatchCreateTargetSitesResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BatchCreateTargetSitesOperation) Wait
func (op *BatchCreateTargetSitesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.BatchCreateTargetSitesResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
BatchVerifyTargetSitesOperation
type BatchVerifyTargetSitesOperation struct { // contains filtered or unexported fields }BatchVerifyTargetSitesOperation manages a long-running operation from BatchVerifyTargetSites.
func (*BatchVerifyTargetSitesOperation) Done
func (op *BatchVerifyTargetSitesOperation) Done() boolDone reports whether the long-running operation has completed.
func (*BatchVerifyTargetSitesOperation) Metadata
func (op *BatchVerifyTargetSitesOperation) Metadata() (*discoveryenginepb.BatchVerifyTargetSitesMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchVerifyTargetSitesOperation) Name
func (op *BatchVerifyTargetSitesOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*BatchVerifyTargetSitesOperation) Poll
func (op *BatchVerifyTargetSitesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.BatchVerifyTargetSitesResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*BatchVerifyTargetSitesOperation) Wait
func (op *BatchVerifyTargetSitesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.BatchVerifyTargetSitesResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ChunkCallOptions
type ChunkCallOptions struct { GetChunk []gax.CallOption ListChunks []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }ChunkCallOptions contains the retry settings for each method of ChunkClient.
ChunkClient
type ChunkClient struct { // The call options for this service. CallOptions *ChunkCallOptions // contains filtered or unexported fields }ChunkClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for displaying processed Chunk information of the customer’s unstructured data.
func NewChunkClient
func NewChunkClient(ctx context.Context, opts ...option.ClientOption) (*ChunkClient, error)NewChunkClient creates a new chunk service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for displaying processed Chunk information of the customer’s unstructured data.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewChunkRESTClient
func NewChunkRESTClient(ctx context.Context, opts ...option.ClientOption) (*ChunkClient, error)NewChunkRESTClient creates a new chunk service rest client.
Service for displaying processed Chunk information of the customer’s unstructured data.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewChunkRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*ChunkClient) CancelOperation
func (c *ChunkClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*ChunkClient) Close
func (c *ChunkClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ChunkClient) Connection (deprecated)
func (c *ChunkClient) 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 (*ChunkClient) GetChunk
func (c *ChunkClient) GetChunk(ctx context.Context, req *discoveryenginepb.GetChunkRequest, opts ...gax.CallOption) (*discoveryenginepb.Chunk, error)GetChunk gets a Document.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetChunkRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetChunkRequest. } resp, err := c.GetChunk(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ChunkClient) GetOperation
func (c *ChunkClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ChunkClient) ListChunks
func (c *ChunkClient) ListChunks(ctx context.Context, req *discoveryenginepb.ListChunksRequest, opts ...gax.CallOption) *ChunkIteratorListChunks gets a list of Chunks.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListChunksRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListChunksRequest. } it := c.ListChunks(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.(*discoveryenginepb.ListChunksResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListChunksRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListChunksRequest. } for resp, err := range c.ListChunks(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ChunkClient) ListOperations
func (c *ChunkClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewChunkClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } ChunkIterator
type ChunkIterator 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 []*discoveryenginepb.Chunk, nextPageToken string, err error) // contains filtered or unexported fields }ChunkIterator manages a stream of *discoveryenginepb.Chunk.
func (*ChunkIterator) All
func (it *ChunkIterator) All() iter.Seq2[*discoveryenginepb.Chunk, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ChunkIterator) Next
func (it *ChunkIterator) Next() (*discoveryenginepb.Chunk, 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 (*ChunkIterator) PageInfo
func (it *ChunkIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CompletionCallOptions
type CompletionCallOptions struct { CompleteQuery []gax.CallOption ImportSuggestionDenyListEntries []gax.CallOption PurgeSuggestionDenyListEntries []gax.CallOption ImportCompletionSuggestions []gax.CallOption PurgeCompletionSuggestions []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }CompletionCallOptions contains the retry settings for each method of CompletionClient.
CompletionClient
type CompletionClient struct { // The call options for this service. CallOptions *CompletionCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }CompletionClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for Auto-Completion.
func NewCompletionClient
func NewCompletionClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)NewCompletionClient creates a new completion service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for Auto-Completion.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewCompletionRESTClient
func NewCompletionRESTClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)NewCompletionRESTClient creates a new completion service rest client.
Service for Auto-Completion.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewCompletionRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*CompletionClient) CancelOperation
func (c *CompletionClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*CompletionClient) Close
func (c *CompletionClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CompletionClient) CompleteQuery
func (c *CompletionClient) CompleteQuery(ctx context.Context, req *discoveryenginepb.CompleteQueryRequest, opts ...gax.CallOption) (*discoveryenginepb.CompleteQueryResponse, error)CompleteQuery completes the specified user input with keyword suggestions.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CompleteQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CompleteQueryRequest. } resp, err := c.CompleteQuery(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*CompletionClient) Connection (deprecated)
func (c *CompletionClient) 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 (*CompletionClient) GetOperation
func (c *CompletionClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*CompletionClient) ImportCompletionSuggestions
func (c *CompletionClient) ImportCompletionSuggestions(ctx context.Context, req *discoveryenginepb.ImportCompletionSuggestionsRequest, opts ...gax.CallOption) (*ImportCompletionSuggestionsOperation, error)ImportCompletionSuggestions imports CompletionSuggestions for a DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ImportCompletionSuggestionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ImportCompletionSuggestionsRequest. } op, err := c.ImportCompletionSuggestions(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*CompletionClient) ImportCompletionSuggestionsOperation
func (c *CompletionClient) ImportCompletionSuggestionsOperation(name string) *ImportCompletionSuggestionsOperationImportCompletionSuggestionsOperation returns a new ImportCompletionSuggestionsOperation from a given name. The name must be that of a previously created ImportCompletionSuggestionsOperation, possibly from a different process.
func (*CompletionClient) ImportSuggestionDenyListEntries
func (c *CompletionClient) ImportSuggestionDenyListEntries(ctx context.Context, req *discoveryenginepb.ImportSuggestionDenyListEntriesRequest, opts ...gax.CallOption) (*ImportSuggestionDenyListEntriesOperation, error)ImportSuggestionDenyListEntries imports all SuggestionDenyListEntry for a DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ImportSuggestionDenyListEntriesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ImportSuggestionDenyListEntriesRequest. } op, err := c.ImportSuggestionDenyListEntries(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*CompletionClient) ImportSuggestionDenyListEntriesOperation
func (c *CompletionClient) ImportSuggestionDenyListEntriesOperation(name string) *ImportSuggestionDenyListEntriesOperationImportSuggestionDenyListEntriesOperation returns a new ImportSuggestionDenyListEntriesOperation from a given name. The name must be that of a previously created ImportSuggestionDenyListEntriesOperation, possibly from a different process.
func (*CompletionClient) ListOperations
func (c *CompletionClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*CompletionClient) PurgeCompletionSuggestions
func (c *CompletionClient) PurgeCompletionSuggestions(ctx context.Context, req *discoveryenginepb.PurgeCompletionSuggestionsRequest, opts ...gax.CallOption) (*PurgeCompletionSuggestionsOperation, error)PurgeCompletionSuggestions permanently deletes all CompletionSuggestions for a DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.PurgeCompletionSuggestionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#PurgeCompletionSuggestionsRequest. } op, err := c.PurgeCompletionSuggestions(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*CompletionClient) PurgeCompletionSuggestionsOperation
func (c *CompletionClient) PurgeCompletionSuggestionsOperation(name string) *PurgeCompletionSuggestionsOperationPurgeCompletionSuggestionsOperation returns a new PurgeCompletionSuggestionsOperation from a given name. The name must be that of a previously created PurgeCompletionSuggestionsOperation, possibly from a different process.
func (*CompletionClient) PurgeSuggestionDenyListEntries
func (c *CompletionClient) PurgeSuggestionDenyListEntries(ctx context.Context, req *discoveryenginepb.PurgeSuggestionDenyListEntriesRequest, opts ...gax.CallOption) (*PurgeSuggestionDenyListEntriesOperation, error)PurgeSuggestionDenyListEntries permanently deletes all SuggestionDenyListEntry for a DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewCompletionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.PurgeSuggestionDenyListEntriesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#PurgeSuggestionDenyListEntriesRequest. } op, err := c.PurgeSuggestionDenyListEntries(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*CompletionClient) PurgeSuggestionDenyListEntriesOperation
func (c *CompletionClient) PurgeSuggestionDenyListEntriesOperation(name string) *PurgeSuggestionDenyListEntriesOperationPurgeSuggestionDenyListEntriesOperation returns a new PurgeSuggestionDenyListEntriesOperation from a given name. The name must be that of a previously created PurgeSuggestionDenyListEntriesOperation, possibly from a different process.
ControlCallOptions
type ControlCallOptions struct { CreateControl []gax.CallOption DeleteControl []gax.CallOption UpdateControl []gax.CallOption GetControl []gax.CallOption ListControls []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }ControlCallOptions contains the retry settings for each method of ControlClient.
ControlClient
type ControlClient struct { // The call options for this service. CallOptions *ControlCallOptions // contains filtered or unexported fields }ControlClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for performing CRUD operations on Controls. Controls allow for custom logic to be implemented in the serving path. Controls need to be attached to a Serving Config to be considered during a request.
func NewControlClient
func NewControlClient(ctx context.Context, opts ...option.ClientOption) (*ControlClient, error)NewControlClient creates a new control service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for performing CRUD operations on Controls. Controls allow for custom logic to be implemented in the serving path. Controls need to be attached to a Serving Config to be considered during a request.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewControlRESTClient
func NewControlRESTClient(ctx context.Context, opts ...option.ClientOption) (*ControlClient, error)NewControlRESTClient creates a new control service rest client.
Service for performing CRUD operations on Controls. Controls allow for custom logic to be implemented in the serving path. Controls need to be attached to a Serving Config to be considered during a request.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewControlRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*ControlClient) CancelOperation
func (c *ControlClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*ControlClient) Close
func (c *ControlClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ControlClient) Connection (deprecated)
func (c *ControlClient) 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 (*ControlClient) CreateControl
func (c *ControlClient) CreateControl(ctx context.Context, req *discoveryenginepb.CreateControlRequest, opts ...gax.CallOption) (*discoveryenginepb.Control, error)CreateControl creates a Control.
By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the Control to create already exists, an ALREADY_EXISTS error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateControlRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateControlRequest. } resp, err := c.CreateControl(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ControlClient) DeleteControl
func (c *ControlClient) DeleteControl(ctx context.Context, req *discoveryenginepb.DeleteControlRequest, opts ...gax.CallOption) errorDeleteControl deletes a Control.
If the Control to delete does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteControlRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteControlRequest. } err = c.DeleteControl(ctx, req) if err != nil { // TODO: Handle error. } } func (*ControlClient) GetControl
func (c *ControlClient) GetControl(ctx context.Context, req *discoveryenginepb.GetControlRequest, opts ...gax.CallOption) (*discoveryenginepb.Control, error)GetControl gets a Control.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetControlRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetControlRequest. } resp, err := c.GetControl(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ControlClient) GetOperation
func (c *ControlClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ControlClient) ListControls
func (c *ControlClient) ListControls(ctx context.Context, req *discoveryenginepb.ListControlsRequest, opts ...gax.CallOption) *ControlIteratorListControls lists all Controls by their parent DataStore.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListControlsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListControlsRequest. } it := c.ListControls(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.(*discoveryenginepb.ListControlsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListControlsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListControlsRequest. } for resp, err := range c.ListControls(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ControlClient) ListOperations
func (c *ControlClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ControlClient) UpdateControl
func (c *ControlClient) UpdateControl(ctx context.Context, req *discoveryenginepb.UpdateControlRequest, opts ...gax.CallOption) (*discoveryenginepb.Control, error)UpdateControl updates a Control.
Control action type cannot be changed. If the Control to update does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewControlClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateControlRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateControlRequest. } resp, err := c.UpdateControl(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } ControlIterator
type ControlIterator 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 []*discoveryenginepb.Control, nextPageToken string, err error) // contains filtered or unexported fields }ControlIterator manages a stream of *discoveryenginepb.Control.
func (*ControlIterator) All
func (it *ControlIterator) All() iter.Seq2[*discoveryenginepb.Control, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ControlIterator) Next
func (it *ControlIterator) Next() (*discoveryenginepb.Control, 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 (*ControlIterator) PageInfo
func (it *ControlIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ConversationIterator
type ConversationIterator 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 []*discoveryenginepb.Conversation, nextPageToken string, err error) // contains filtered or unexported fields }ConversationIterator manages a stream of *discoveryenginepb.Conversation.
func (*ConversationIterator) All
func (it *ConversationIterator) All() iter.Seq2[*discoveryenginepb.Conversation, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ConversationIterator) Next
func (it *ConversationIterator) Next() (*discoveryenginepb.Conversation, 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 (*ConversationIterator) PageInfo
func (it *ConversationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ConversationalSearchCallOptions
type ConversationalSearchCallOptions struct { ConverseConversation []gax.CallOption CreateConversation []gax.CallOption DeleteConversation []gax.CallOption UpdateConversation []gax.CallOption GetConversation []gax.CallOption ListConversations []gax.CallOption AnswerQuery []gax.CallOption GetAnswer []gax.CallOption CreateSession []gax.CallOption DeleteSession []gax.CallOption UpdateSession []gax.CallOption GetSession []gax.CallOption ListSessions []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }ConversationalSearchCallOptions contains the retry settings for each method of ConversationalSearchClient.
ConversationalSearchClient
type ConversationalSearchClient struct { // The call options for this service. CallOptions *ConversationalSearchCallOptions // contains filtered or unexported fields }ConversationalSearchClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for conversational search.
func NewConversationalSearchClient
func NewConversationalSearchClient(ctx context.Context, opts ...option.ClientOption) (*ConversationalSearchClient, error)NewConversationalSearchClient creates a new conversational search service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for conversational search.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewConversationalSearchRESTClient
func NewConversationalSearchRESTClient(ctx context.Context, opts ...option.ClientOption) (*ConversationalSearchClient, error)NewConversationalSearchRESTClient creates a new conversational search service rest client.
Service for conversational search.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewConversationalSearchRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*ConversationalSearchClient) AnswerQuery
func (c *ConversationalSearchClient) AnswerQuery(ctx context.Context, req *discoveryenginepb.AnswerQueryRequest, opts ...gax.CallOption) (*discoveryenginepb.AnswerQueryResponse, error)AnswerQuery answer query method.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.AnswerQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#AnswerQueryRequest. } resp, err := c.AnswerQuery(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) CancelOperation
func (c *ConversationalSearchClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*ConversationalSearchClient) Close
func (c *ConversationalSearchClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ConversationalSearchClient) Connection (deprecated)
func (c *ConversationalSearchClient) 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 (*ConversationalSearchClient) ConverseConversation
func (c *ConversationalSearchClient) ConverseConversation(ctx context.Context, req *discoveryenginepb.ConverseConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.ConverseConversationResponse, error)ConverseConversation converses a conversation.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ConverseConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ConverseConversationRequest. } resp, err := c.ConverseConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) CreateConversation
func (c *ConversationalSearchClient) CreateConversation(ctx context.Context, req *discoveryenginepb.CreateConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.Conversation, error)CreateConversation creates a Conversation.
If the Conversation to create already exists, an ALREADY_EXISTS error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateConversationRequest. } resp, err := c.CreateConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) CreateSession
func (c *ConversationalSearchClient) CreateSession(ctx context.Context, req *discoveryenginepb.CreateSessionRequest, opts ...gax.CallOption) (*discoveryenginepb.Session, error)CreateSession creates a Session.
If the Session to create already exists, an ALREADY_EXISTS error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateSessionRequest. } resp, err := c.CreateSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) DeleteConversation
func (c *ConversationalSearchClient) DeleteConversation(ctx context.Context, req *discoveryenginepb.DeleteConversationRequest, opts ...gax.CallOption) errorDeleteConversation deletes a Conversation.
If the Conversation to delete does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteConversationRequest. } err = c.DeleteConversation(ctx, req) if err != nil { // TODO: Handle error. } } func (*ConversationalSearchClient) DeleteSession
func (c *ConversationalSearchClient) DeleteSession(ctx context.Context, req *discoveryenginepb.DeleteSessionRequest, opts ...gax.CallOption) errorDeleteSession deletes a Session.
If the Session to delete does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteSessionRequest. } err = c.DeleteSession(ctx, req) if err != nil { // TODO: Handle error. } } func (*ConversationalSearchClient) GetAnswer
func (c *ConversationalSearchClient) GetAnswer(ctx context.Context, req *discoveryenginepb.GetAnswerRequest, opts ...gax.CallOption) (*discoveryenginepb.Answer, error)GetAnswer gets a Answer.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetAnswerRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetAnswerRequest. } resp, err := c.GetAnswer(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) GetConversation
func (c *ConversationalSearchClient) GetConversation(ctx context.Context, req *discoveryenginepb.GetConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.Conversation, error)GetConversation gets a Conversation.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetConversationRequest. } resp, err := c.GetConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) GetOperation
func (c *ConversationalSearchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) GetSession
func (c *ConversationalSearchClient) GetSession(ctx context.Context, req *discoveryenginepb.GetSessionRequest, opts ...gax.CallOption) (*discoveryenginepb.Session, error)GetSession gets a Session.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetSessionRequest. } resp, err := c.GetSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) ListConversations
func (c *ConversationalSearchClient) ListConversations(ctx context.Context, req *discoveryenginepb.ListConversationsRequest, opts ...gax.CallOption) *ConversationIteratorListConversations lists all Conversations by their parent DataStore.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListConversationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListConversationsRequest. } it := c.ListConversations(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.(*discoveryenginepb.ListConversationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListConversationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListConversationsRequest. } for resp, err := range c.ListConversations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ConversationalSearchClient) ListOperations
func (c *ConversationalSearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ConversationalSearchClient) ListSessions
func (c *ConversationalSearchClient) ListSessions(ctx context.Context, req *discoveryenginepb.ListSessionsRequest, opts ...gax.CallOption) *SessionIteratorListSessions lists all Sessions by their parent DataStore.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSessionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSessionsRequest. } it := c.ListSessions(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.(*discoveryenginepb.ListSessionsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSessionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSessionsRequest. } for resp, err := range c.ListSessions(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ConversationalSearchClient) UpdateConversation
func (c *ConversationalSearchClient) UpdateConversation(ctx context.Context, req *discoveryenginepb.UpdateConversationRequest, opts ...gax.CallOption) (*discoveryenginepb.Conversation, error)UpdateConversation updates a Conversation.
Conversation action type cannot be changed. If the Conversation to update does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateConversationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateConversationRequest. } resp, err := c.UpdateConversation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ConversationalSearchClient) UpdateSession
func (c *ConversationalSearchClient) UpdateSession(ctx context.Context, req *discoveryenginepb.UpdateSessionRequest, opts ...gax.CallOption) (*discoveryenginepb.Session, error)UpdateSession updates a Session.
Session action type cannot be changed. If the Session to update does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewConversationalSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateSessionRequest. } resp, err := c.UpdateSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } CreateDataStoreOperation
type CreateDataStoreOperation struct { // contains filtered or unexported fields }CreateDataStoreOperation manages a long-running operation from CreateDataStore.
func (*CreateDataStoreOperation) Done
func (op *CreateDataStoreOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateDataStoreOperation) Metadata
func (op *CreateDataStoreOperation) Metadata() (*discoveryenginepb.CreateDataStoreMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateDataStoreOperation) Name
func (op *CreateDataStoreOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateDataStoreOperation) Poll
func (op *CreateDataStoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.DataStore, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateDataStoreOperation) Wait
func (op *CreateDataStoreOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.DataStore, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CreateEngineOperation
type CreateEngineOperation struct { // contains filtered or unexported fields }CreateEngineOperation manages a long-running operation from CreateEngine.
func (*CreateEngineOperation) Done
func (op *CreateEngineOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateEngineOperation) Metadata
func (op *CreateEngineOperation) Metadata() (*discoveryenginepb.CreateEngineMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateEngineOperation) Name
func (op *CreateEngineOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateEngineOperation) Poll
func (op *CreateEngineOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Engine, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateEngineOperation) Wait
func (op *CreateEngineOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Engine, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CreateEvaluationOperation
type CreateEvaluationOperation struct { // contains filtered or unexported fields }CreateEvaluationOperation manages a long-running operation from CreateEvaluation.
func (*CreateEvaluationOperation) Done
func (op *CreateEvaluationOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateEvaluationOperation) Metadata
func (op *CreateEvaluationOperation) Metadata() (*discoveryenginepb.CreateEvaluationMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateEvaluationOperation) Name
func (op *CreateEvaluationOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateEvaluationOperation) Poll
func (op *CreateEvaluationOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Evaluation, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateEvaluationOperation) Wait
func (op *CreateEvaluationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Evaluation, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CreateSchemaOperation
type CreateSchemaOperation struct { // contains filtered or unexported fields }CreateSchemaOperation manages a long-running operation from CreateSchema.
func (*CreateSchemaOperation) Done
func (op *CreateSchemaOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateSchemaOperation) Metadata
func (op *CreateSchemaOperation) Metadata() (*discoveryenginepb.CreateSchemaMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateSchemaOperation) Name
func (op *CreateSchemaOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateSchemaOperation) Poll
func (op *CreateSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateSchemaOperation) Wait
func (op *CreateSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CreateTargetSiteOperation
type CreateTargetSiteOperation struct { // contains filtered or unexported fields }CreateTargetSiteOperation manages a long-running operation from CreateTargetSite.
func (*CreateTargetSiteOperation) Done
func (op *CreateTargetSiteOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateTargetSiteOperation) Metadata
func (op *CreateTargetSiteOperation) Metadata() (*discoveryenginepb.CreateTargetSiteMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateTargetSiteOperation) Name
func (op *CreateTargetSiteOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreateTargetSiteOperation) Poll
func (op *CreateTargetSiteOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TargetSite, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreateTargetSiteOperation) Wait
func (op *CreateTargetSiteOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TargetSite, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DataStoreCallOptions
type DataStoreCallOptions struct { CreateDataStore []gax.CallOption GetDataStore []gax.CallOption ListDataStores []gax.CallOption DeleteDataStore []gax.CallOption UpdateDataStore []gax.CallOption GetDocumentProcessingConfig []gax.CallOption UpdateDocumentProcessingConfig []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }DataStoreCallOptions contains the retry settings for each method of DataStoreClient.
DataStoreClient
type DataStoreClient struct { // The call options for this service. CallOptions *DataStoreCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }DataStoreClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing DataStore configuration.
func NewDataStoreClient
func NewDataStoreClient(ctx context.Context, opts ...option.ClientOption) (*DataStoreClient, error)NewDataStoreClient creates a new data store service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing DataStore configuration.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewDataStoreRESTClient
func NewDataStoreRESTClient(ctx context.Context, opts ...option.ClientOption) (*DataStoreClient, error)NewDataStoreRESTClient creates a new data store service rest client.
Service for managing DataStore configuration.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewDataStoreRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*DataStoreClient) CancelOperation
func (c *DataStoreClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*DataStoreClient) Close
func (c *DataStoreClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DataStoreClient) Connection (deprecated)
func (c *DataStoreClient) 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 (*DataStoreClient) CreateDataStore
func (c *DataStoreClient) CreateDataStore(ctx context.Context, req *discoveryenginepb.CreateDataStoreRequest, opts ...gax.CallOption) (*CreateDataStoreOperation, error)CreateDataStore creates a DataStore.
DataStore is for storing Documents. To serve these documents for Search, or Recommendation use case, an Engine needs to be created separately.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateDataStoreRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateDataStoreRequest. } op, err := c.CreateDataStore(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DataStoreClient) CreateDataStoreOperation
func (c *DataStoreClient) CreateDataStoreOperation(name string) *CreateDataStoreOperationCreateDataStoreOperation returns a new CreateDataStoreOperation from a given name. The name must be that of a previously created CreateDataStoreOperation, possibly from a different process.
func (*DataStoreClient) DeleteDataStore
func (c *DataStoreClient) DeleteDataStore(ctx context.Context, req *discoveryenginepb.DeleteDataStoreRequest, opts ...gax.CallOption) (*DeleteDataStoreOperation, error)DeleteDataStore deletes a DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteDataStoreRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteDataStoreRequest. } op, err := c.DeleteDataStore(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func (*DataStoreClient) DeleteDataStoreOperation
func (c *DataStoreClient) DeleteDataStoreOperation(name string) *DeleteDataStoreOperationDeleteDataStoreOperation returns a new DeleteDataStoreOperation from a given name. The name must be that of a previously created DeleteDataStoreOperation, possibly from a different process.
func (*DataStoreClient) GetDataStore
func (c *DataStoreClient) GetDataStore(ctx context.Context, req *discoveryenginepb.GetDataStoreRequest, opts ...gax.CallOption) (*discoveryenginepb.DataStore, error)GetDataStore gets a DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetDataStoreRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetDataStoreRequest. } resp, err := c.GetDataStore(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DataStoreClient) GetDocumentProcessingConfig
func (c *DataStoreClient) GetDocumentProcessingConfig(ctx context.Context, req *discoveryenginepb.GetDocumentProcessingConfigRequest, opts ...gax.CallOption) (*discoveryenginepb.DocumentProcessingConfig, error)GetDocumentProcessingConfig gets a DocumentProcessingConfig.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetDocumentProcessingConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetDocumentProcessingConfigRequest. } resp, err := c.GetDocumentProcessingConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DataStoreClient) GetOperation
func (c *DataStoreClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DataStoreClient) ListDataStores
func (c *DataStoreClient) ListDataStores(ctx context.Context, req *discoveryenginepb.ListDataStoresRequest, opts ...gax.CallOption) *DataStoreIteratorListDataStores lists all the DataStores associated with the project.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListDataStoresRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListDataStoresRequest. } it := c.ListDataStores(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.(*discoveryenginepb.ListDataStoresResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListDataStoresRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListDataStoresRequest. } for resp, err := range c.ListDataStores(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*DataStoreClient) ListOperations
func (c *DataStoreClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*DataStoreClient) UpdateDataStore
func (c *DataStoreClient) UpdateDataStore(ctx context.Context, req *discoveryenginepb.UpdateDataStoreRequest, opts ...gax.CallOption) (*discoveryenginepb.DataStore, error)UpdateDataStore updates a DataStore
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateDataStoreRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateDataStoreRequest. } resp, err := c.UpdateDataStore(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DataStoreClient) UpdateDocumentProcessingConfig
func (c *DataStoreClient) UpdateDocumentProcessingConfig(ctx context.Context, req *discoveryenginepb.UpdateDocumentProcessingConfigRequest, opts ...gax.CallOption) (*discoveryenginepb.DocumentProcessingConfig, error)UpdateDocumentProcessingConfig updates the DocumentProcessingConfig. DocumentProcessingConfig is a singleon resource of DataStore. It’s empty when DataStore is created. The first call to this method will set up DocumentProcessingConfig.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDataStoreClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateDocumentProcessingConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateDocumentProcessingConfigRequest. } resp, err := c.UpdateDocumentProcessingConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } DataStoreIterator
type DataStoreIterator 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 []*discoveryenginepb.DataStore, nextPageToken string, err error) // contains filtered or unexported fields }DataStoreIterator manages a stream of *discoveryenginepb.DataStore.
func (*DataStoreIterator) All
func (it *DataStoreIterator) All() iter.Seq2[*discoveryenginepb.DataStore, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DataStoreIterator) Next
func (it *DataStoreIterator) Next() (*discoveryenginepb.DataStore, 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 (*DataStoreIterator) PageInfo
func (it *DataStoreIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
DeleteDataStoreOperation
type DeleteDataStoreOperation struct { // contains filtered or unexported fields }DeleteDataStoreOperation manages a long-running operation from DeleteDataStore.
func (*DeleteDataStoreOperation) Done
func (op *DeleteDataStoreOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteDataStoreOperation) Metadata
func (op *DeleteDataStoreOperation) Metadata() (*discoveryenginepb.DeleteDataStoreMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteDataStoreOperation) Name
func (op *DeleteDataStoreOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteDataStoreOperation) Poll
func (op *DeleteDataStoreOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteDataStoreOperation) Wait
func (op *DeleteDataStoreOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteEngineOperation
type DeleteEngineOperation struct { // contains filtered or unexported fields }DeleteEngineOperation manages a long-running operation from DeleteEngine.
func (*DeleteEngineOperation) Done
func (op *DeleteEngineOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteEngineOperation) Metadata
func (op *DeleteEngineOperation) Metadata() (*discoveryenginepb.DeleteEngineMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteEngineOperation) Name
func (op *DeleteEngineOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteEngineOperation) Poll
func (op *DeleteEngineOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteEngineOperation) Wait
func (op *DeleteEngineOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteSchemaOperation
type DeleteSchemaOperation struct { // contains filtered or unexported fields }DeleteSchemaOperation manages a long-running operation from DeleteSchema.
func (*DeleteSchemaOperation) Done
func (op *DeleteSchemaOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteSchemaOperation) Metadata
func (op *DeleteSchemaOperation) Metadata() (*discoveryenginepb.DeleteSchemaMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteSchemaOperation) Name
func (op *DeleteSchemaOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteSchemaOperation) Poll
func (op *DeleteSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteSchemaOperation) Wait
func (op *DeleteSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteTargetSiteOperation
type DeleteTargetSiteOperation struct { // contains filtered or unexported fields }DeleteTargetSiteOperation manages a long-running operation from DeleteTargetSite.
func (*DeleteTargetSiteOperation) Done
func (op *DeleteTargetSiteOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteTargetSiteOperation) Metadata
func (op *DeleteTargetSiteOperation) Metadata() (*discoveryenginepb.DeleteTargetSiteMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteTargetSiteOperation) Name
func (op *DeleteTargetSiteOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DeleteTargetSiteOperation) Poll
func (op *DeleteTargetSiteOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DeleteTargetSiteOperation) Wait
func (op *DeleteTargetSiteOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DisableAdvancedSiteSearchOperation
type DisableAdvancedSiteSearchOperation struct { // contains filtered or unexported fields }DisableAdvancedSiteSearchOperation manages a long-running operation from DisableAdvancedSiteSearch.
func (*DisableAdvancedSiteSearchOperation) Done
func (op *DisableAdvancedSiteSearchOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DisableAdvancedSiteSearchOperation) Metadata
func (op *DisableAdvancedSiteSearchOperation) Metadata() (*discoveryenginepb.DisableAdvancedSiteSearchMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DisableAdvancedSiteSearchOperation) Name
func (op *DisableAdvancedSiteSearchOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*DisableAdvancedSiteSearchOperation) Poll
func (op *DisableAdvancedSiteSearchOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.DisableAdvancedSiteSearchResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*DisableAdvancedSiteSearchOperation) Wait
func (op *DisableAdvancedSiteSearchOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.DisableAdvancedSiteSearchResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DocumentCallOptions
type DocumentCallOptions struct { GetDocument []gax.CallOption ListDocuments []gax.CallOption CreateDocument []gax.CallOption UpdateDocument []gax.CallOption DeleteDocument []gax.CallOption ImportDocuments []gax.CallOption PurgeDocuments []gax.CallOption GetProcessedDocument []gax.CallOption BatchGetDocumentsMetadata []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }DocumentCallOptions contains the retry settings for each method of DocumentClient.
DocumentClient
type DocumentClient struct { // The call options for this service. CallOptions *DocumentCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }DocumentClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for ingesting Document information of the customer’s website.
func NewDocumentClient
func NewDocumentClient(ctx context.Context, opts ...option.ClientOption) (*DocumentClient, error)NewDocumentClient creates a new document service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for ingesting Document information of the customer’s website.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewDocumentRESTClient
func NewDocumentRESTClient(ctx context.Context, opts ...option.ClientOption) (*DocumentClient, error)NewDocumentRESTClient creates a new document service rest client.
Service for ingesting Document information of the customer’s website.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewDocumentRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*DocumentClient) BatchGetDocumentsMetadata
func (c *DocumentClient) BatchGetDocumentsMetadata(ctx context.Context, req *discoveryenginepb.BatchGetDocumentsMetadataRequest, opts ...gax.CallOption) (*discoveryenginepb.BatchGetDocumentsMetadataResponse, error)BatchGetDocumentsMetadata gets index freshness metadata for Documents. Supported for website search only.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.BatchGetDocumentsMetadataRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#BatchGetDocumentsMetadataRequest. } resp, err := c.BatchGetDocumentsMetadata(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DocumentClient) CancelOperation
func (c *DocumentClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*DocumentClient) Close
func (c *DocumentClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*DocumentClient) Connection (deprecated)
func (c *DocumentClient) 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 (*DocumentClient) CreateDocument
func (c *DocumentClient) CreateDocument(ctx context.Context, req *discoveryenginepb.CreateDocumentRequest, opts ...gax.CallOption) (*discoveryenginepb.Document, error)CreateDocument creates a Document.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateDocumentRequest. } resp, err := c.CreateDocument(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DocumentClient) DeleteDocument
func (c *DocumentClient) DeleteDocument(ctx context.Context, req *discoveryenginepb.DeleteDocumentRequest, opts ...gax.CallOption) errorDeleteDocument deletes a Document.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteDocumentRequest. } err = c.DeleteDocument(ctx, req) if err != nil { // TODO: Handle error. } } func (*DocumentClient) GetDocument
func (c *DocumentClient) GetDocument(ctx context.Context, req *discoveryenginepb.GetDocumentRequest, opts ...gax.CallOption) (*discoveryenginepb.Document, error)GetDocument gets a Document.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetDocumentRequest. } resp, err := c.GetDocument(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DocumentClient) GetOperation
func (c *DocumentClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DocumentClient) GetProcessedDocument
func (c *DocumentClient) GetProcessedDocument(ctx context.Context, req *discoveryenginepb.GetProcessedDocumentRequest, opts ...gax.CallOption) (*discoveryenginepb.ProcessedDocument, error)GetProcessedDocument gets the parsed layout information for a Document.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetProcessedDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetProcessedDocumentRequest. } resp, err := c.GetProcessedDocument(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DocumentClient) ImportDocuments
func (c *DocumentClient) ImportDocuments(ctx context.Context, req *discoveryenginepb.ImportDocumentsRequest, opts ...gax.CallOption) (*ImportDocumentsOperation, error)ImportDocuments bulk import of multiple Documents. Request processing may be synchronous. Non-existing items are created.
Note: It is possible for a subset of the Documents to be successfully updated.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ImportDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ImportDocumentsRequest. } op, err := c.ImportDocuments(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DocumentClient) ImportDocumentsOperation
func (c *DocumentClient) ImportDocumentsOperation(name string) *ImportDocumentsOperationImportDocumentsOperation returns a new ImportDocumentsOperation from a given name. The name must be that of a previously created ImportDocumentsOperation, possibly from a different process.
func (*DocumentClient) ListDocuments
func (c *DocumentClient) ListDocuments(ctx context.Context, req *discoveryenginepb.ListDocumentsRequest, opts ...gax.CallOption) *DocumentIteratorListDocuments gets a list of Documents.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListDocumentsRequest. } it := c.ListDocuments(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.(*discoveryenginepb.ListDocumentsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListDocumentsRequest. } for resp, err := range c.ListDocuments(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*DocumentClient) ListOperations
func (c *DocumentClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*DocumentClient) PurgeDocuments
func (c *DocumentClient) PurgeDocuments(ctx context.Context, req *discoveryenginepb.PurgeDocumentsRequest, opts ...gax.CallOption) (*PurgeDocumentsOperation, error)PurgeDocuments permanently deletes all selected Documents in a branch.
This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.
To get a list of the Documents to be deleted, set PurgeDocumentsRequest.force to false.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.PurgeDocumentsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#PurgeDocumentsRequest. } op, err := c.PurgeDocuments(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*DocumentClient) PurgeDocumentsOperation
func (c *DocumentClient) PurgeDocumentsOperation(name string) *PurgeDocumentsOperationPurgeDocumentsOperation returns a new PurgeDocumentsOperation from a given name. The name must be that of a previously created PurgeDocumentsOperation, possibly from a different process.
func (*DocumentClient) UpdateDocument
func (c *DocumentClient) UpdateDocument(ctx context.Context, req *discoveryenginepb.UpdateDocumentRequest, opts ...gax.CallOption) (*discoveryenginepb.Document, error)UpdateDocument updates a Document.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewDocumentClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateDocumentRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateDocumentRequest. } resp, err := c.UpdateDocument(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } DocumentIterator
type DocumentIterator 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 []*discoveryenginepb.Document, nextPageToken string, err error) // contains filtered or unexported fields }DocumentIterator manages a stream of *discoveryenginepb.Document.
func (*DocumentIterator) All
func (it *DocumentIterator) All() iter.Seq2[*discoveryenginepb.Document, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DocumentIterator) Next
func (it *DocumentIterator) Next() (*discoveryenginepb.Document, 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 (*DocumentIterator) PageInfo
func (it *DocumentIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
EnableAdvancedSiteSearchOperation
type EnableAdvancedSiteSearchOperation struct { // contains filtered or unexported fields }EnableAdvancedSiteSearchOperation manages a long-running operation from EnableAdvancedSiteSearch.
func (*EnableAdvancedSiteSearchOperation) Done
func (op *EnableAdvancedSiteSearchOperation) Done() boolDone reports whether the long-running operation has completed.
func (*EnableAdvancedSiteSearchOperation) Metadata
func (op *EnableAdvancedSiteSearchOperation) Metadata() (*discoveryenginepb.EnableAdvancedSiteSearchMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*EnableAdvancedSiteSearchOperation) Name
func (op *EnableAdvancedSiteSearchOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*EnableAdvancedSiteSearchOperation) Poll
func (op *EnableAdvancedSiteSearchOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.EnableAdvancedSiteSearchResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*EnableAdvancedSiteSearchOperation) Wait
func (op *EnableAdvancedSiteSearchOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.EnableAdvancedSiteSearchResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
EngineCallOptions
type EngineCallOptions struct { CreateEngine []gax.CallOption DeleteEngine []gax.CallOption UpdateEngine []gax.CallOption GetEngine []gax.CallOption ListEngines []gax.CallOption PauseEngine []gax.CallOption ResumeEngine []gax.CallOption TuneEngine []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }EngineCallOptions contains the retry settings for each method of EngineClient.
EngineClient
type EngineClient struct { // The call options for this service. CallOptions *EngineCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }EngineClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing Engine configuration.
func NewEngineClient
func NewEngineClient(ctx context.Context, opts ...option.ClientOption) (*EngineClient, error)NewEngineClient creates a new engine service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Engine configuration.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewEngineRESTClient
func NewEngineRESTClient(ctx context.Context, opts ...option.ClientOption) (*EngineClient, error)NewEngineRESTClient creates a new engine service rest client.
Service for managing Engine configuration.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewEngineRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*EngineClient) CancelOperation
func (c *EngineClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*EngineClient) Close
func (c *EngineClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*EngineClient) Connection (deprecated)
func (c *EngineClient) 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 (*EngineClient) CreateEngine
func (c *EngineClient) CreateEngine(ctx context.Context, req *discoveryenginepb.CreateEngineRequest, opts ...gax.CallOption) (*CreateEngineOperation, error)CreateEngine creates a Engine.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateEngineRequest. } op, err := c.CreateEngine(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EngineClient) CreateEngineOperation
func (c *EngineClient) CreateEngineOperation(name string) *CreateEngineOperationCreateEngineOperation returns a new CreateEngineOperation from a given name. The name must be that of a previously created CreateEngineOperation, possibly from a different process.
func (*EngineClient) DeleteEngine
func (c *EngineClient) DeleteEngine(ctx context.Context, req *discoveryenginepb.DeleteEngineRequest, opts ...gax.CallOption) (*DeleteEngineOperation, error)DeleteEngine deletes a Engine.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteEngineRequest. } op, err := c.DeleteEngine(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func (*EngineClient) DeleteEngineOperation
func (c *EngineClient) DeleteEngineOperation(name string) *DeleteEngineOperationDeleteEngineOperation returns a new DeleteEngineOperation from a given name. The name must be that of a previously created DeleteEngineOperation, possibly from a different process.
func (*EngineClient) GetEngine
func (c *EngineClient) GetEngine(ctx context.Context, req *discoveryenginepb.GetEngineRequest, opts ...gax.CallOption) (*discoveryenginepb.Engine, error)GetEngine gets a Engine.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetEngineRequest. } resp, err := c.GetEngine(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EngineClient) GetOperation
func (c *EngineClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EngineClient) ListEngines
func (c *EngineClient) ListEngines(ctx context.Context, req *discoveryenginepb.ListEnginesRequest, opts ...gax.CallOption) *EngineIteratorListEngines lists all the Engines associated with the project.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListEnginesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListEnginesRequest. } it := c.ListEngines(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.(*discoveryenginepb.ListEnginesResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListEnginesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListEnginesRequest. } for resp, err := range c.ListEngines(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*EngineClient) ListOperations
func (c *EngineClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*EngineClient) PauseEngine
func (c *EngineClient) PauseEngine(ctx context.Context, req *discoveryenginepb.PauseEngineRequest, opts ...gax.CallOption) (*discoveryenginepb.Engine, error)PauseEngine pauses the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.PauseEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#PauseEngineRequest. } resp, err := c.PauseEngine(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EngineClient) ResumeEngine
func (c *EngineClient) ResumeEngine(ctx context.Context, req *discoveryenginepb.ResumeEngineRequest, opts ...gax.CallOption) (*discoveryenginepb.Engine, error)ResumeEngine resumes the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ResumeEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ResumeEngineRequest. } resp, err := c.ResumeEngine(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EngineClient) TuneEngine
func (c *EngineClient) TuneEngine(ctx context.Context, req *discoveryenginepb.TuneEngineRequest, opts ...gax.CallOption) (*TuneEngineOperation, error)TuneEngine tunes an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.TuneEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#TuneEngineRequest. } op, err := c.TuneEngine(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EngineClient) TuneEngineOperation
func (c *EngineClient) TuneEngineOperation(name string) *TuneEngineOperationTuneEngineOperation returns a new TuneEngineOperation from a given name. The name must be that of a previously created TuneEngineOperation, possibly from a different process.
func (*EngineClient) UpdateEngine
func (c *EngineClient) UpdateEngine(ctx context.Context, req *discoveryenginepb.UpdateEngineRequest, opts ...gax.CallOption) (*discoveryenginepb.Engine, error)UpdateEngine updates an Engine
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateEngineRequest. } resp, err := c.UpdateEngine(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } EngineIterator
type EngineIterator 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 []*discoveryenginepb.Engine, nextPageToken string, err error) // contains filtered or unexported fields }EngineIterator manages a stream of *discoveryenginepb.Engine.
func (*EngineIterator) All
func (it *EngineIterator) All() iter.Seq2[*discoveryenginepb.Engine, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*EngineIterator) Next
func (it *EngineIterator) Next() (*discoveryenginepb.Engine, 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 (*EngineIterator) PageInfo
func (it *EngineIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
EstimateBillingCallOptions
type EstimateBillingCallOptions struct { EstimateDataSize []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }EstimateBillingCallOptions contains the retry settings for each method of EstimateBillingClient.
EstimateBillingClient
type EstimateBillingClient struct { // The call options for this service. CallOptions *EstimateBillingCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }EstimateBillingClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing billing estimations resources.
func NewEstimateBillingClient
func NewEstimateBillingClient(ctx context.Context, opts ...option.ClientOption) (*EstimateBillingClient, error)NewEstimateBillingClient creates a new estimate billing service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing billing estimations resources.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewEstimateBillingClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewEstimateBillingRESTClient
func NewEstimateBillingRESTClient(ctx context.Context, opts ...option.ClientOption) (*EstimateBillingClient, error)NewEstimateBillingRESTClient creates a new estimate billing service rest client.
Service for managing billing estimations resources.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewEstimateBillingRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*EstimateBillingClient) CancelOperation
func (c *EstimateBillingClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEstimateBillingClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*EstimateBillingClient) Close
func (c *EstimateBillingClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*EstimateBillingClient) Connection (deprecated)
func (c *EstimateBillingClient) 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 (*EstimateBillingClient) EstimateDataSize
func (c *EstimateBillingClient) EstimateDataSize(ctx context.Context, req *discoveryenginepb.EstimateDataSizeRequest, opts ...gax.CallOption) (*EstimateDataSizeOperation, error)EstimateDataSize estimates the data size to be used by a customer.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEstimateBillingClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.EstimateDataSizeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#EstimateDataSizeRequest. } op, err := c.EstimateDataSize(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EstimateBillingClient) EstimateDataSizeOperation
func (c *EstimateBillingClient) EstimateDataSizeOperation(name string) *EstimateDataSizeOperationEstimateDataSizeOperation returns a new EstimateDataSizeOperation from a given name. The name must be that of a previously created EstimateDataSizeOperation, possibly from a different process.
func (*EstimateBillingClient) GetOperation
func (c *EstimateBillingClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEstimateBillingClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EstimateBillingClient) ListOperations
func (c *EstimateBillingClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewEstimateBillingClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEstimateBillingClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } EstimateDataSizeOperation
type EstimateDataSizeOperation struct { // contains filtered or unexported fields }EstimateDataSizeOperation manages a long-running operation from EstimateDataSize.
func (*EstimateDataSizeOperation) Done
func (op *EstimateDataSizeOperation) Done() boolDone reports whether the long-running operation has completed.
func (*EstimateDataSizeOperation) Metadata
func (op *EstimateDataSizeOperation) Metadata() (*discoveryenginepb.EstimateDataSizeMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*EstimateDataSizeOperation) Name
func (op *EstimateDataSizeOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*EstimateDataSizeOperation) Poll
func (op *EstimateDataSizeOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.EstimateDataSizeResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*EstimateDataSizeOperation) Wait
func (op *EstimateDataSizeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.EstimateDataSizeResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
EvaluationCallOptions
type EvaluationCallOptions struct { GetEvaluation []gax.CallOption ListEvaluations []gax.CallOption CreateEvaluation []gax.CallOption ListEvaluationResults []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }EvaluationCallOptions contains the retry settings for each method of EvaluationClient.
EvaluationClient
type EvaluationClient struct { // The call options for this service. CallOptions *EvaluationCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }EvaluationClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing Evaluations,
func NewEvaluationClient
func NewEvaluationClient(ctx context.Context, opts ...option.ClientOption) (*EvaluationClient, error)NewEvaluationClient creates a new evaluation service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Evaluations,
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewEvaluationRESTClient
func NewEvaluationRESTClient(ctx context.Context, opts ...option.ClientOption) (*EvaluationClient, error)NewEvaluationRESTClient creates a new evaluation service rest client.
Service for managing Evaluations,
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewEvaluationRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*EvaluationClient) CancelOperation
func (c *EvaluationClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*EvaluationClient) Close
func (c *EvaluationClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*EvaluationClient) Connection (deprecated)
func (c *EvaluationClient) 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 (*EvaluationClient) CreateEvaluation
func (c *EvaluationClient) CreateEvaluation(ctx context.Context, req *discoveryenginepb.CreateEvaluationRequest, opts ...gax.CallOption) (*CreateEvaluationOperation, error)CreateEvaluation creates a Evaluation.
Upon creation, the evaluation will be automatically triggered and begin execution.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateEvaluationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateEvaluationRequest. } op, err := c.CreateEvaluation(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EvaluationClient) CreateEvaluationOperation
func (c *EvaluationClient) CreateEvaluationOperation(name string) *CreateEvaluationOperationCreateEvaluationOperation returns a new CreateEvaluationOperation from a given name. The name must be that of a previously created CreateEvaluationOperation, possibly from a different process.
func (*EvaluationClient) GetEvaluation
func (c *EvaluationClient) GetEvaluation(ctx context.Context, req *discoveryenginepb.GetEvaluationRequest, opts ...gax.CallOption) (*discoveryenginepb.Evaluation, error)GetEvaluation gets a Evaluation.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetEvaluationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetEvaluationRequest. } resp, err := c.GetEvaluation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EvaluationClient) GetOperation
func (c *EvaluationClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*EvaluationClient) ListEvaluationResults
func (c *EvaluationClient) ListEvaluationResults(ctx context.Context, req *discoveryenginepb.ListEvaluationResultsRequest, opts ...gax.CallOption) *ListEvaluationResultsResponse_EvaluationResultIteratorListEvaluationResults gets a list of results for a given a Evaluation.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListEvaluationResultsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListEvaluationResultsRequest. } it := c.ListEvaluationResults(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.(*discoveryenginepb.ListEvaluationResultsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListEvaluationResultsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListEvaluationResultsRequest. } for resp, err := range c.ListEvaluationResults(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*EvaluationClient) ListEvaluations
func (c *EvaluationClient) ListEvaluations(ctx context.Context, req *discoveryenginepb.ListEvaluationsRequest, opts ...gax.CallOption) *EvaluationIteratorListEvaluations gets a list of Evaluations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListEvaluationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListEvaluationsRequest. } it := c.ListEvaluations(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.(*discoveryenginepb.ListEvaluationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListEvaluationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListEvaluationsRequest. } for resp, err := range c.ListEvaluations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*EvaluationClient) ListOperations
func (c *EvaluationClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewEvaluationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } EvaluationIterator
type EvaluationIterator 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 []*discoveryenginepb.Evaluation, nextPageToken string, err error) // contains filtered or unexported fields }EvaluationIterator manages a stream of *discoveryenginepb.Evaluation.
func (*EvaluationIterator) All
func (it *EvaluationIterator) All() iter.Seq2[*discoveryenginepb.Evaluation, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*EvaluationIterator) Next
func (it *EvaluationIterator) Next() (*discoveryenginepb.Evaluation, 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 (*EvaluationIterator) PageInfo
func (it *EvaluationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
FileMetadataIterator
type FileMetadataIterator 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 []*discoveryenginepb.FileMetadata, nextPageToken string, err error) // contains filtered or unexported fields }FileMetadataIterator manages a stream of *discoveryenginepb.FileMetadata.
func (*FileMetadataIterator) All
func (it *FileMetadataIterator) All() iter.Seq2[*discoveryenginepb.FileMetadata, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*FileMetadataIterator) Next
func (it *FileMetadataIterator) Next() (*discoveryenginepb.FileMetadata, 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 (*FileMetadataIterator) PageInfo
func (it *FileMetadataIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
GroundedGenerationCallOptions
type GroundedGenerationCallOptions struct { CheckGrounding []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }GroundedGenerationCallOptions contains the retry settings for each method of GroundedGenerationClient.
GroundedGenerationClient
type GroundedGenerationClient struct { // The call options for this service. CallOptions *GroundedGenerationCallOptions // contains filtered or unexported fields }GroundedGenerationClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for grounded generation.
func NewGroundedGenerationClient
func NewGroundedGenerationClient(ctx context.Context, opts ...option.ClientOption) (*GroundedGenerationClient, error)NewGroundedGenerationClient creates a new grounded generation service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for grounded generation.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewGroundedGenerationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewGroundedGenerationRESTClient
func NewGroundedGenerationRESTClient(ctx context.Context, opts ...option.ClientOption) (*GroundedGenerationClient, error)NewGroundedGenerationRESTClient creates a new grounded generation service rest client.
Service for grounded generation.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewGroundedGenerationRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*GroundedGenerationClient) CancelOperation
func (c *GroundedGenerationClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewGroundedGenerationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*GroundedGenerationClient) CheckGrounding
func (c *GroundedGenerationClient) CheckGrounding(ctx context.Context, req *discoveryenginepb.CheckGroundingRequest, opts ...gax.CallOption) (*discoveryenginepb.CheckGroundingResponse, error)CheckGrounding performs a grounding check.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewGroundedGenerationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CheckGroundingRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CheckGroundingRequest. } resp, err := c.CheckGrounding(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*GroundedGenerationClient) Close
func (c *GroundedGenerationClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*GroundedGenerationClient) Connection (deprecated)
func (c *GroundedGenerationClient) 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 (*GroundedGenerationClient) GetOperation
func (c *GroundedGenerationClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewGroundedGenerationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*GroundedGenerationClient) ListOperations
func (c *GroundedGenerationClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewGroundedGenerationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewGroundedGenerationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } ImportCompletionSuggestionsOperation
type ImportCompletionSuggestionsOperation struct { // contains filtered or unexported fields }ImportCompletionSuggestionsOperation manages a long-running operation from ImportCompletionSuggestions.
func (*ImportCompletionSuggestionsOperation) Done
func (op *ImportCompletionSuggestionsOperation) Done() boolDone reports whether the long-running operation has completed.
func (*ImportCompletionSuggestionsOperation) Metadata
func (op *ImportCompletionSuggestionsOperation) Metadata() (*discoveryenginepb.ImportCompletionSuggestionsMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportCompletionSuggestionsOperation) Name
func (op *ImportCompletionSuggestionsOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportCompletionSuggestionsOperation) Poll
func (op *ImportCompletionSuggestionsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportCompletionSuggestionsResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportCompletionSuggestionsOperation) Wait
func (op *ImportCompletionSuggestionsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportCompletionSuggestionsResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ImportDocumentsOperation
type ImportDocumentsOperation struct { // contains filtered or unexported fields }ImportDocumentsOperation manages a long-running operation from ImportDocuments.
func (*ImportDocumentsOperation) Done
func (op *ImportDocumentsOperation) Done() boolDone reports whether the long-running operation has completed.
func (*ImportDocumentsOperation) Metadata
func (op *ImportDocumentsOperation) Metadata() (*discoveryenginepb.ImportDocumentsMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportDocumentsOperation) Name
func (op *ImportDocumentsOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportDocumentsOperation) Poll
func (op *ImportDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportDocumentsResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportDocumentsOperation) Wait
func (op *ImportDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportDocumentsResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ImportSampleQueriesOperation
type ImportSampleQueriesOperation struct { // contains filtered or unexported fields }ImportSampleQueriesOperation manages a long-running operation from ImportSampleQueries.
func (*ImportSampleQueriesOperation) Done
func (op *ImportSampleQueriesOperation) Done() boolDone reports whether the long-running operation has completed.
func (*ImportSampleQueriesOperation) Metadata
func (op *ImportSampleQueriesOperation) Metadata() (*discoveryenginepb.ImportSampleQueriesMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportSampleQueriesOperation) Name
func (op *ImportSampleQueriesOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportSampleQueriesOperation) Poll
func (op *ImportSampleQueriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportSampleQueriesResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportSampleQueriesOperation) Wait
func (op *ImportSampleQueriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportSampleQueriesResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ImportSuggestionDenyListEntriesOperation
type ImportSuggestionDenyListEntriesOperation struct { // contains filtered or unexported fields }ImportSuggestionDenyListEntriesOperation manages a long-running operation from ImportSuggestionDenyListEntries.
func (*ImportSuggestionDenyListEntriesOperation) Done
func (op *ImportSuggestionDenyListEntriesOperation) Done() boolDone reports whether the long-running operation has completed.
func (*ImportSuggestionDenyListEntriesOperation) Metadata
func (op *ImportSuggestionDenyListEntriesOperation) Metadata() (*discoveryenginepb.ImportSuggestionDenyListEntriesMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportSuggestionDenyListEntriesOperation) Name
func (op *ImportSuggestionDenyListEntriesOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportSuggestionDenyListEntriesOperation) Poll
func (op *ImportSuggestionDenyListEntriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportSuggestionDenyListEntriesResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportSuggestionDenyListEntriesOperation) Wait
func (op *ImportSuggestionDenyListEntriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportSuggestionDenyListEntriesResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ImportUserEventsOperation
type ImportUserEventsOperation struct { // contains filtered or unexported fields }ImportUserEventsOperation manages a long-running operation from ImportUserEvents.
func (*ImportUserEventsOperation) Done
func (op *ImportUserEventsOperation) Done() boolDone reports whether the long-running operation has completed.
func (*ImportUserEventsOperation) Metadata
func (op *ImportUserEventsOperation) Metadata() (*discoveryenginepb.ImportUserEventsMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ImportUserEventsOperation) Name
func (op *ImportUserEventsOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ImportUserEventsOperation) Poll
func (op *ImportUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportUserEventsResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ImportUserEventsOperation) Wait
func (op *ImportUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.ImportUserEventsResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ListEvaluationResultsResponse_EvaluationResultIterator
type ListEvaluationResultsResponse_EvaluationResultIterator 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 []*discoveryenginepb.ListEvaluationResultsResponse_EvaluationResult, nextPageToken string, err error) // contains filtered or unexported fields }ListEvaluationResultsResponse_EvaluationResultIterator manages a stream of *discoveryenginepb.ListEvaluationResultsResponse_EvaluationResult.
func (*ListEvaluationResultsResponse_EvaluationResultIterator) All
func (it *ListEvaluationResultsResponse_EvaluationResultIterator) All() iter.Seq2[*discoveryenginepb.ListEvaluationResultsResponse_EvaluationResult, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ListEvaluationResultsResponse_EvaluationResultIterator) Next
func (it *ListEvaluationResultsResponse_EvaluationResultIterator) Next() (*discoveryenginepb.ListEvaluationResultsResponse_EvaluationResult, 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 (*ListEvaluationResultsResponse_EvaluationResultIterator) PageInfo
func (it *ListEvaluationResultsResponse_EvaluationResultIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OperationIterator
type OperationIterator 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 []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next
func (it *OperationIterator) Next() (*longrunningpb.Operation, 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 (*OperationIterator) PageInfo
func (it *OperationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ProjectCallOptions
type ProjectCallOptions struct { GetProject []gax.CallOption ProvisionProject []gax.CallOption ReportConsentChange []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }ProjectCallOptions contains the retry settings for each method of ProjectClient.
ProjectClient
type ProjectClient struct { // The call options for this service. CallOptions *ProjectCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }ProjectClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for operations on the Project.
func NewProjectClient
func NewProjectClient(ctx context.Context, opts ...option.ClientOption) (*ProjectClient, error)NewProjectClient creates a new project service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for operations on the Project.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewProjectRESTClient
func NewProjectRESTClient(ctx context.Context, opts ...option.ClientOption) (*ProjectClient, error)NewProjectRESTClient creates a new project service rest client.
Service for operations on the Project.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewProjectRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*ProjectClient) CancelOperation
func (c *ProjectClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*ProjectClient) Close
func (c *ProjectClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ProjectClient) Connection (deprecated)
func (c *ProjectClient) 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 (*ProjectClient) GetOperation
func (c *ProjectClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ProjectClient) GetProject
func (c *ProjectClient) GetProject(ctx context.Context, req *discoveryenginepb.GetProjectRequest, opts ...gax.CallOption) (*discoveryenginepb.Project, error)GetProject gets a Project. Returns NOT_FOUND when the project is not yet created.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetProjectRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetProjectRequest. } resp, err := c.GetProject(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ProjectClient) ListOperations
func (c *ProjectClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ProjectClient) ProvisionProject
func (c *ProjectClient) ProvisionProject(ctx context.Context, req *discoveryenginepb.ProvisionProjectRequest, opts ...gax.CallOption) (*ProvisionProjectOperation, error)ProvisionProject provisions the project resource. During the process, related systems will get prepared and initialized.
Caller must read the Terms for data use (at https://cloud.google.com/retail/data-use-terms), and optionally specify in request to provide consent to that service terms.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ProvisionProjectRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ProvisionProjectRequest. } op, err := c.ProvisionProject(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ProjectClient) ProvisionProjectOperation
func (c *ProjectClient) ProvisionProjectOperation(name string) *ProvisionProjectOperationProvisionProjectOperation returns a new ProvisionProjectOperation from a given name. The name must be that of a previously created ProvisionProjectOperation, possibly from a different process.
func (*ProjectClient) ReportConsentChange
func (c *ProjectClient) ReportConsentChange(ctx context.Context, req *discoveryenginepb.ReportConsentChangeRequest, opts ...gax.CallOption) (*discoveryenginepb.Project, error)ReportConsentChange updates service terms for this project.
This method can be used to retroactively accept the latest terms.
Terms available for update:
Terms for data use (at https://cloud.google.com/retail/data-use-terms) Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewProjectClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ReportConsentChangeRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ReportConsentChangeRequest. } resp, err := c.ReportConsentChange(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } ProvisionProjectOperation
type ProvisionProjectOperation struct { // contains filtered or unexported fields }ProvisionProjectOperation manages a long-running operation from ProvisionProject.
func (*ProvisionProjectOperation) Done
func (op *ProvisionProjectOperation) Done() boolDone reports whether the long-running operation has completed.
func (*ProvisionProjectOperation) Metadata
func (op *ProvisionProjectOperation) Metadata() (*discoveryenginepb.ProvisionProjectMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*ProvisionProjectOperation) Name
func (op *ProvisionProjectOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*ProvisionProjectOperation) Poll
func (op *ProvisionProjectOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Project, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*ProvisionProjectOperation) Wait
func (op *ProvisionProjectOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Project, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
PurgeCompletionSuggestionsOperation
type PurgeCompletionSuggestionsOperation struct { // contains filtered or unexported fields }PurgeCompletionSuggestionsOperation manages a long-running operation from PurgeCompletionSuggestions.
func (*PurgeCompletionSuggestionsOperation) Done
func (op *PurgeCompletionSuggestionsOperation) Done() boolDone reports whether the long-running operation has completed.
func (*PurgeCompletionSuggestionsOperation) Metadata
func (op *PurgeCompletionSuggestionsOperation) Metadata() (*discoveryenginepb.PurgeCompletionSuggestionsMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*PurgeCompletionSuggestionsOperation) Name
func (op *PurgeCompletionSuggestionsOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*PurgeCompletionSuggestionsOperation) Poll
func (op *PurgeCompletionSuggestionsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeCompletionSuggestionsResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*PurgeCompletionSuggestionsOperation) Wait
func (op *PurgeCompletionSuggestionsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeCompletionSuggestionsResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
PurgeDocumentsOperation
type PurgeDocumentsOperation struct { // contains filtered or unexported fields }PurgeDocumentsOperation manages a long-running operation from PurgeDocuments.
func (*PurgeDocumentsOperation) Done
func (op *PurgeDocumentsOperation) Done() boolDone reports whether the long-running operation has completed.
func (*PurgeDocumentsOperation) Metadata
func (op *PurgeDocumentsOperation) Metadata() (*discoveryenginepb.PurgeDocumentsMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*PurgeDocumentsOperation) Name
func (op *PurgeDocumentsOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*PurgeDocumentsOperation) Poll
func (op *PurgeDocumentsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeDocumentsResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*PurgeDocumentsOperation) Wait
func (op *PurgeDocumentsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeDocumentsResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
PurgeSuggestionDenyListEntriesOperation
type PurgeSuggestionDenyListEntriesOperation struct { // contains filtered or unexported fields }PurgeSuggestionDenyListEntriesOperation manages a long-running operation from PurgeSuggestionDenyListEntries.
func (*PurgeSuggestionDenyListEntriesOperation) Done
func (op *PurgeSuggestionDenyListEntriesOperation) Done() boolDone reports whether the long-running operation has completed.
func (*PurgeSuggestionDenyListEntriesOperation) Metadata
func (op *PurgeSuggestionDenyListEntriesOperation) Metadata() (*discoveryenginepb.PurgeSuggestionDenyListEntriesMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*PurgeSuggestionDenyListEntriesOperation) Name
func (op *PurgeSuggestionDenyListEntriesOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*PurgeSuggestionDenyListEntriesOperation) Poll
func (op *PurgeSuggestionDenyListEntriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeSuggestionDenyListEntriesResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*PurgeSuggestionDenyListEntriesOperation) Wait
func (op *PurgeSuggestionDenyListEntriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeSuggestionDenyListEntriesResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
PurgeUserEventsOperation
type PurgeUserEventsOperation struct { // contains filtered or unexported fields }PurgeUserEventsOperation manages a long-running operation from PurgeUserEvents.
func (*PurgeUserEventsOperation) Done
func (op *PurgeUserEventsOperation) Done() boolDone reports whether the long-running operation has completed.
func (*PurgeUserEventsOperation) Metadata
func (op *PurgeUserEventsOperation) Metadata() (*discoveryenginepb.PurgeUserEventsMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*PurgeUserEventsOperation) Name
func (op *PurgeUserEventsOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*PurgeUserEventsOperation) Poll
func (op *PurgeUserEventsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeUserEventsResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*PurgeUserEventsOperation) Wait
func (op *PurgeUserEventsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.PurgeUserEventsResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
RankCallOptions
type RankCallOptions struct { Rank []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }RankCallOptions contains the retry settings for each method of RankClient.
RankClient
type RankClient struct { // The call options for this service. CallOptions *RankCallOptions // contains filtered or unexported fields }RankClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for ranking text records.
func NewRankClient
func NewRankClient(ctx context.Context, opts ...option.ClientOption) (*RankClient, error)NewRankClient creates a new rank service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for ranking text records.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewRankClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewRankRESTClient
func NewRankRESTClient(ctx context.Context, opts ...option.ClientOption) (*RankClient, error)NewRankRESTClient creates a new rank service rest client.
Service for ranking text records.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewRankRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*RankClient) CancelOperation
func (c *RankClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewRankClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*RankClient) Close
func (c *RankClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*RankClient) Connection (deprecated)
func (c *RankClient) 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 (*RankClient) GetOperation
func (c *RankClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewRankClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*RankClient) ListOperations
func (c *RankClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewRankClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewRankClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*RankClient) Rank
func (c *RankClient) Rank(ctx context.Context, req *discoveryenginepb.RankRequest, opts ...gax.CallOption) (*discoveryenginepb.RankResponse, error)Rank ranks a list of text records based on the given input query.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewRankClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.RankRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#RankRequest. } resp, err := c.Rank(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } RecommendationCallOptions
type RecommendationCallOptions struct { Recommend []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }RecommendationCallOptions contains the retry settings for each method of RecommendationClient.
RecommendationClient
type RecommendationClient struct { // The call options for this service. CallOptions *RecommendationCallOptions // contains filtered or unexported fields }RecommendationClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for making recommendations.
func NewRecommendationClient
func NewRecommendationClient(ctx context.Context, opts ...option.ClientOption) (*RecommendationClient, error)NewRecommendationClient creates a new recommendation service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for making recommendations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewRecommendationRESTClient
func NewRecommendationRESTClient(ctx context.Context, opts ...option.ClientOption) (*RecommendationClient, error)NewRecommendationRESTClient creates a new recommendation service rest client.
Service for making recommendations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewRecommendationRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*RecommendationClient) CancelOperation
func (c *RecommendationClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*RecommendationClient) Close
func (c *RecommendationClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*RecommendationClient) Connection (deprecated)
func (c *RecommendationClient) 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 (*RecommendationClient) GetOperation
func (c *RecommendationClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*RecommendationClient) ListOperations
func (c *RecommendationClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*RecommendationClient) Recommend
func (c *RecommendationClient) Recommend(ctx context.Context, req *discoveryenginepb.RecommendRequest, opts ...gax.CallOption) (*discoveryenginepb.RecommendResponse, error)Recommend makes a recommendation, which requires a contextual user event.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewRecommendationClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.RecommendRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#RecommendRequest. } resp, err := c.Recommend(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } RecrawlUrisOperation
type RecrawlUrisOperation struct { // contains filtered or unexported fields }RecrawlUrisOperation manages a long-running operation from RecrawlUris.
func (*RecrawlUrisOperation) Done
func (op *RecrawlUrisOperation) Done() boolDone reports whether the long-running operation has completed.
func (*RecrawlUrisOperation) Metadata
func (op *RecrawlUrisOperation) Metadata() (*discoveryenginepb.RecrawlUrisMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*RecrawlUrisOperation) Name
func (op *RecrawlUrisOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*RecrawlUrisOperation) Poll
func (op *RecrawlUrisOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.RecrawlUrisResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*RecrawlUrisOperation) Wait
func (op *RecrawlUrisOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.RecrawlUrisResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
SampleQueryCallOptions
type SampleQueryCallOptions struct { GetSampleQuery []gax.CallOption ListSampleQueries []gax.CallOption CreateSampleQuery []gax.CallOption UpdateSampleQuery []gax.CallOption DeleteSampleQuery []gax.CallOption ImportSampleQueries []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }SampleQueryCallOptions contains the retry settings for each method of SampleQueryClient.
SampleQueryClient
type SampleQueryClient struct { // The call options for this service. CallOptions *SampleQueryCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }SampleQueryClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing SampleQuerys,
func NewSampleQueryClient
func NewSampleQueryClient(ctx context.Context, opts ...option.ClientOption) (*SampleQueryClient, error)NewSampleQueryClient creates a new sample query service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing SampleQuerys,
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewSampleQueryRESTClient
func NewSampleQueryRESTClient(ctx context.Context, opts ...option.ClientOption) (*SampleQueryClient, error)NewSampleQueryRESTClient creates a new sample query service rest client.
Service for managing SampleQuerys,
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSampleQueryRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*SampleQueryClient) CancelOperation
func (c *SampleQueryClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*SampleQueryClient) Close
func (c *SampleQueryClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SampleQueryClient) Connection (deprecated)
func (c *SampleQueryClient) 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 (*SampleQueryClient) CreateSampleQuery
func (c *SampleQueryClient) CreateSampleQuery(ctx context.Context, req *discoveryenginepb.CreateSampleQueryRequest, opts ...gax.CallOption) (*discoveryenginepb.SampleQuery, error)CreateSampleQuery creates a SampleQuery
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateSampleQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateSampleQueryRequest. } resp, err := c.CreateSampleQuery(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SampleQueryClient) DeleteSampleQuery
func (c *SampleQueryClient) DeleteSampleQuery(ctx context.Context, req *discoveryenginepb.DeleteSampleQueryRequest, opts ...gax.CallOption) errorDeleteSampleQuery deletes a SampleQuery.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteSampleQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteSampleQueryRequest. } err = c.DeleteSampleQuery(ctx, req) if err != nil { // TODO: Handle error. } } func (*SampleQueryClient) GetOperation
func (c *SampleQueryClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SampleQueryClient) GetSampleQuery
func (c *SampleQueryClient) GetSampleQuery(ctx context.Context, req *discoveryenginepb.GetSampleQueryRequest, opts ...gax.CallOption) (*discoveryenginepb.SampleQuery, error)GetSampleQuery gets a SampleQuery.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetSampleQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetSampleQueryRequest. } resp, err := c.GetSampleQuery(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SampleQueryClient) ImportSampleQueries
func (c *SampleQueryClient) ImportSampleQueries(ctx context.Context, req *discoveryenginepb.ImportSampleQueriesRequest, opts ...gax.CallOption) (*ImportSampleQueriesOperation, error)ImportSampleQueries bulk import of multiple SampleQuerys. Sample queries that already exist may be deleted.
Note: It is possible for a subset of the SampleQuerys to be successfully imported.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ImportSampleQueriesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ImportSampleQueriesRequest. } op, err := c.ImportSampleQueries(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SampleQueryClient) ImportSampleQueriesOperation
func (c *SampleQueryClient) ImportSampleQueriesOperation(name string) *ImportSampleQueriesOperationImportSampleQueriesOperation returns a new ImportSampleQueriesOperation from a given name. The name must be that of a previously created ImportSampleQueriesOperation, possibly from a different process.
func (*SampleQueryClient) ListOperations
func (c *SampleQueryClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SampleQueryClient) ListSampleQueries
func (c *SampleQueryClient) ListSampleQueries(ctx context.Context, req *discoveryenginepb.ListSampleQueriesRequest, opts ...gax.CallOption) *SampleQueryIteratorListSampleQueries gets a list of SampleQuerys.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSampleQueriesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSampleQueriesRequest. } it := c.ListSampleQueries(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.(*discoveryenginepb.ListSampleQueriesResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSampleQueriesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSampleQueriesRequest. } for resp, err := range c.ListSampleQueries(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SampleQueryClient) UpdateSampleQuery
func (c *SampleQueryClient) UpdateSampleQuery(ctx context.Context, req *discoveryenginepb.UpdateSampleQueryRequest, opts ...gax.CallOption) (*discoveryenginepb.SampleQuery, error)UpdateSampleQuery updates a SampleQuery.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQueryClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateSampleQueryRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateSampleQueryRequest. } resp, err := c.UpdateSampleQuery(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } SampleQueryIterator
type SampleQueryIterator 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 []*discoveryenginepb.SampleQuery, nextPageToken string, err error) // contains filtered or unexported fields }SampleQueryIterator manages a stream of *discoveryenginepb.SampleQuery.
func (*SampleQueryIterator) All
func (it *SampleQueryIterator) All() iter.Seq2[*discoveryenginepb.SampleQuery, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SampleQueryIterator) Next
func (it *SampleQueryIterator) Next() (*discoveryenginepb.SampleQuery, 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 (*SampleQueryIterator) PageInfo
func (it *SampleQueryIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SampleQuerySetCallOptions
type SampleQuerySetCallOptions struct { GetSampleQuerySet []gax.CallOption ListSampleQuerySets []gax.CallOption CreateSampleQuerySet []gax.CallOption UpdateSampleQuerySet []gax.CallOption DeleteSampleQuerySet []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }SampleQuerySetCallOptions contains the retry settings for each method of SampleQuerySetClient.
SampleQuerySetClient
type SampleQuerySetClient struct { // The call options for this service. CallOptions *SampleQuerySetCallOptions // contains filtered or unexported fields }SampleQuerySetClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing SampleQuerySets,
func NewSampleQuerySetClient
func NewSampleQuerySetClient(ctx context.Context, opts ...option.ClientOption) (*SampleQuerySetClient, error)NewSampleQuerySetClient creates a new sample query set service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing SampleQuerySets,
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewSampleQuerySetRESTClient
func NewSampleQuerySetRESTClient(ctx context.Context, opts ...option.ClientOption) (*SampleQuerySetClient, error)NewSampleQuerySetRESTClient creates a new sample query set service rest client.
Service for managing SampleQuerySets,
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSampleQuerySetRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*SampleQuerySetClient) CancelOperation
func (c *SampleQuerySetClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*SampleQuerySetClient) Close
func (c *SampleQuerySetClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SampleQuerySetClient) Connection (deprecated)
func (c *SampleQuerySetClient) 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 (*SampleQuerySetClient) CreateSampleQuerySet
func (c *SampleQuerySetClient) CreateSampleQuerySet(ctx context.Context, req *discoveryenginepb.CreateSampleQuerySetRequest, opts ...gax.CallOption) (*discoveryenginepb.SampleQuerySet, error)CreateSampleQuerySet creates a SampleQuerySet
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateSampleQuerySetRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateSampleQuerySetRequest. } resp, err := c.CreateSampleQuerySet(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SampleQuerySetClient) DeleteSampleQuerySet
func (c *SampleQuerySetClient) DeleteSampleQuerySet(ctx context.Context, req *discoveryenginepb.DeleteSampleQuerySetRequest, opts ...gax.CallOption) errorDeleteSampleQuerySet deletes a SampleQuerySet.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteSampleQuerySetRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteSampleQuerySetRequest. } err = c.DeleteSampleQuerySet(ctx, req) if err != nil { // TODO: Handle error. } } func (*SampleQuerySetClient) GetOperation
func (c *SampleQuerySetClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SampleQuerySetClient) GetSampleQuerySet
func (c *SampleQuerySetClient) GetSampleQuerySet(ctx context.Context, req *discoveryenginepb.GetSampleQuerySetRequest, opts ...gax.CallOption) (*discoveryenginepb.SampleQuerySet, error)GetSampleQuerySet gets a SampleQuerySet.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetSampleQuerySetRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetSampleQuerySetRequest. } resp, err := c.GetSampleQuerySet(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SampleQuerySetClient) ListOperations
func (c *SampleQuerySetClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SampleQuerySetClient) ListSampleQuerySets
func (c *SampleQuerySetClient) ListSampleQuerySets(ctx context.Context, req *discoveryenginepb.ListSampleQuerySetsRequest, opts ...gax.CallOption) *SampleQuerySetIteratorListSampleQuerySets gets a list of SampleQuerySets.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSampleQuerySetsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSampleQuerySetsRequest. } it := c.ListSampleQuerySets(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.(*discoveryenginepb.ListSampleQuerySetsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSampleQuerySetsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSampleQuerySetsRequest. } for resp, err := range c.ListSampleQuerySets(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SampleQuerySetClient) UpdateSampleQuerySet
func (c *SampleQuerySetClient) UpdateSampleQuerySet(ctx context.Context, req *discoveryenginepb.UpdateSampleQuerySetRequest, opts ...gax.CallOption) (*discoveryenginepb.SampleQuerySet, error)UpdateSampleQuerySet updates a SampleQuerySet.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSampleQuerySetClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateSampleQuerySetRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateSampleQuerySetRequest. } resp, err := c.UpdateSampleQuerySet(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } SampleQuerySetIterator
type SampleQuerySetIterator 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 []*discoveryenginepb.SampleQuerySet, nextPageToken string, err error) // contains filtered or unexported fields }SampleQuerySetIterator manages a stream of *discoveryenginepb.SampleQuerySet.
func (*SampleQuerySetIterator) All
func (it *SampleQuerySetIterator) All() iter.Seq2[*discoveryenginepb.SampleQuerySet, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SampleQuerySetIterator) Next
func (it *SampleQuerySetIterator) Next() (*discoveryenginepb.SampleQuerySet, 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 (*SampleQuerySetIterator) PageInfo
func (it *SampleQuerySetIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SchemaCallOptions
type SchemaCallOptions struct { GetSchema []gax.CallOption ListSchemas []gax.CallOption CreateSchema []gax.CallOption UpdateSchema []gax.CallOption DeleteSchema []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }SchemaCallOptions contains the retry settings for each method of SchemaClient.
SchemaClient
type SchemaClient struct { // The call options for this service. CallOptions *SchemaCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }SchemaClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing Schemas.
func NewSchemaClient
func NewSchemaClient(ctx context.Context, opts ...option.ClientOption) (*SchemaClient, error)NewSchemaClient creates a new schema service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Schemas.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewSchemaRESTClient
func NewSchemaRESTClient(ctx context.Context, opts ...option.ClientOption) (*SchemaClient, error)NewSchemaRESTClient creates a new schema service rest client.
Service for managing Schemas.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSchemaRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*SchemaClient) CancelOperation
func (c *SchemaClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*SchemaClient) Close
func (c *SchemaClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SchemaClient) Connection (deprecated)
func (c *SchemaClient) 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 (*SchemaClient) CreateSchema
func (c *SchemaClient) CreateSchema(ctx context.Context, req *discoveryenginepb.CreateSchemaRequest, opts ...gax.CallOption) (*CreateSchemaOperation, error)CreateSchema creates a Schema.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateSchemaRequest. } op, err := c.CreateSchema(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SchemaClient) CreateSchemaOperation
func (c *SchemaClient) CreateSchemaOperation(name string) *CreateSchemaOperationCreateSchemaOperation returns a new CreateSchemaOperation from a given name. The name must be that of a previously created CreateSchemaOperation, possibly from a different process.
func (*SchemaClient) DeleteSchema
func (c *SchemaClient) DeleteSchema(ctx context.Context, req *discoveryenginepb.DeleteSchemaRequest, opts ...gax.CallOption) (*DeleteSchemaOperation, error)DeleteSchema deletes a Schema.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteSchemaRequest. } op, err := c.DeleteSchema(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func (*SchemaClient) DeleteSchemaOperation
func (c *SchemaClient) DeleteSchemaOperation(name string) *DeleteSchemaOperationDeleteSchemaOperation returns a new DeleteSchemaOperation from a given name. The name must be that of a previously created DeleteSchemaOperation, possibly from a different process.
func (*SchemaClient) GetOperation
func (c *SchemaClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SchemaClient) GetSchema
func (c *SchemaClient) GetSchema(ctx context.Context, req *discoveryenginepb.GetSchemaRequest, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)GetSchema gets a Schema.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetSchemaRequest. } resp, err := c.GetSchema(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SchemaClient) ListOperations
func (c *SchemaClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SchemaClient) ListSchemas
func (c *SchemaClient) ListSchemas(ctx context.Context, req *discoveryenginepb.ListSchemasRequest, opts ...gax.CallOption) *SchemaIteratorListSchemas gets a list of Schemas.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSchemasRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSchemasRequest. } it := c.ListSchemas(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.(*discoveryenginepb.ListSchemasResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSchemasRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSchemasRequest. } for resp, err := range c.ListSchemas(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SchemaClient) UpdateSchema
func (c *SchemaClient) UpdateSchema(ctx context.Context, req *discoveryenginepb.UpdateSchemaRequest, opts ...gax.CallOption) (*UpdateSchemaOperation, error)UpdateSchema updates a Schema.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSchemaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateSchemaRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateSchemaRequest. } op, err := c.UpdateSchema(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SchemaClient) UpdateSchemaOperation
func (c *SchemaClient) UpdateSchemaOperation(name string) *UpdateSchemaOperationUpdateSchemaOperation returns a new UpdateSchemaOperation from a given name. The name must be that of a previously created UpdateSchemaOperation, possibly from a different process.
SchemaIterator
type SchemaIterator 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 []*discoveryenginepb.Schema, nextPageToken string, err error) // contains filtered or unexported fields }SchemaIterator manages a stream of *discoveryenginepb.Schema.
func (*SchemaIterator) All
func (it *SchemaIterator) All() iter.Seq2[*discoveryenginepb.Schema, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SchemaIterator) Next
func (it *SchemaIterator) Next() (*discoveryenginepb.Schema, 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 (*SchemaIterator) PageInfo
func (it *SchemaIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SearchCallOptions
type SearchCallOptions struct { Search []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }SearchCallOptions contains the retry settings for each method of SearchClient.
SearchClient
type SearchClient struct { // The call options for this service. CallOptions *SearchCallOptions // contains filtered or unexported fields }SearchClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for search.
func NewSearchClient
func NewSearchClient(ctx context.Context, opts ...option.ClientOption) (*SearchClient, error)NewSearchClient creates a new search service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for search.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewSearchRESTClient
func NewSearchRESTClient(ctx context.Context, opts ...option.ClientOption) (*SearchClient, error)NewSearchRESTClient creates a new search service rest client.
Service for search.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSearchRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*SearchClient) CancelOperation
func (c *SearchClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*SearchClient) Close
func (c *SearchClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SearchClient) Connection (deprecated)
func (c *SearchClient) 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 (*SearchClient) GetOperation
func (c *SearchClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SearchClient) ListOperations
func (c *SearchClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SearchClient) Search
func (c *SearchClient) Search(ctx context.Context, req *discoveryenginepb.SearchRequest, opts ...gax.CallOption) *SearchResponse_SearchResultIteratorSearch performs a search.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.SearchRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#SearchRequest. } it := c.Search(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.(*discoveryenginepb.SearchResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSearchClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.SearchRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#SearchRequest. } for resp, err := range c.Search(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } SearchResponse_SearchResultIterator
type SearchResponse_SearchResultIterator 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 []*discoveryenginepb.SearchResponse_SearchResult, nextPageToken string, err error) // contains filtered or unexported fields }SearchResponse_SearchResultIterator manages a stream of *discoveryenginepb.SearchResponse_SearchResult.
func (*SearchResponse_SearchResultIterator) All
func (it *SearchResponse_SearchResultIterator) All() iter.Seq2[*discoveryenginepb.SearchResponse_SearchResult, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SearchResponse_SearchResultIterator) Next
func (it *SearchResponse_SearchResultIterator) Next() (*discoveryenginepb.SearchResponse_SearchResult, 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 (*SearchResponse_SearchResultIterator) PageInfo
func (it *SearchResponse_SearchResultIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SearchTuningCallOptions
type SearchTuningCallOptions struct { TrainCustomModel []gax.CallOption ListCustomModels []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }SearchTuningCallOptions contains the retry settings for each method of SearchTuningClient.
SearchTuningClient
type SearchTuningClient struct { // The call options for this service. CallOptions *SearchTuningCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }SearchTuningClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for search tuning.
func NewSearchTuningClient
func NewSearchTuningClient(ctx context.Context, opts ...option.ClientOption) (*SearchTuningClient, error)NewSearchTuningClient creates a new search tuning service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for search tuning.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSearchTuningClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewSearchTuningRESTClient
func NewSearchTuningRESTClient(ctx context.Context, opts ...option.ClientOption) (*SearchTuningClient, error)NewSearchTuningRESTClient creates a new search tuning service rest client.
Service for search tuning.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSearchTuningRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*SearchTuningClient) CancelOperation
func (c *SearchTuningClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSearchTuningClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*SearchTuningClient) Close
func (c *SearchTuningClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SearchTuningClient) Connection (deprecated)
func (c *SearchTuningClient) 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 (*SearchTuningClient) GetOperation
func (c *SearchTuningClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSearchTuningClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SearchTuningClient) ListCustomModels
func (c *SearchTuningClient) ListCustomModels(ctx context.Context, req *discoveryenginepb.ListCustomModelsRequest, opts ...gax.CallOption) (*discoveryenginepb.ListCustomModelsResponse, error)ListCustomModels gets a list of all the custom models.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSearchTuningClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListCustomModelsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListCustomModelsRequest. } resp, err := c.ListCustomModels(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SearchTuningClient) ListOperations
func (c *SearchTuningClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewSearchTuningClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSearchTuningClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SearchTuningClient) TrainCustomModel
func (c *SearchTuningClient) TrainCustomModel(ctx context.Context, req *discoveryenginepb.TrainCustomModelRequest, opts ...gax.CallOption) (*TrainCustomModelOperation, error)TrainCustomModel trains a custom model.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSearchTuningClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.TrainCustomModelRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#TrainCustomModelRequest. } op, err := c.TrainCustomModel(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SearchTuningClient) TrainCustomModelOperation
func (c *SearchTuningClient) TrainCustomModelOperation(name string) *TrainCustomModelOperationTrainCustomModelOperation returns a new TrainCustomModelOperation from a given name. The name must be that of a previously created TrainCustomModelOperation, possibly from a different process.
ServingConfigCallOptions
type ServingConfigCallOptions struct { UpdateServingConfig []gax.CallOption GetServingConfig []gax.CallOption ListServingConfigs []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }ServingConfigCallOptions contains the retry settings for each method of ServingConfigClient.
ServingConfigClient
type ServingConfigClient struct { // The call options for this service. CallOptions *ServingConfigCallOptions // contains filtered or unexported fields }ServingConfigClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for operations related to ServingConfig.
func NewServingConfigClient
func NewServingConfigClient(ctx context.Context, opts ...option.ClientOption) (*ServingConfigClient, error)NewServingConfigClient creates a new serving config service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for operations related to ServingConfig.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewServingConfigRESTClient
func NewServingConfigRESTClient(ctx context.Context, opts ...option.ClientOption) (*ServingConfigClient, error)NewServingConfigRESTClient creates a new serving config service rest client.
Service for operations related to ServingConfig.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewServingConfigRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*ServingConfigClient) CancelOperation
func (c *ServingConfigClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*ServingConfigClient) Close
func (c *ServingConfigClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ServingConfigClient) Connection (deprecated)
func (c *ServingConfigClient) 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 (*ServingConfigClient) GetOperation
func (c *ServingConfigClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ServingConfigClient) GetServingConfig
func (c *ServingConfigClient) GetServingConfig(ctx context.Context, req *discoveryenginepb.GetServingConfigRequest, opts ...gax.CallOption) (*discoveryenginepb.ServingConfig, error)GetServingConfig gets a ServingConfig.
Returns a NotFound error if the ServingConfig does not exist.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetServingConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetServingConfigRequest. } resp, err := c.GetServingConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*ServingConfigClient) ListOperations
func (c *ServingConfigClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ServingConfigClient) ListServingConfigs
func (c *ServingConfigClient) ListServingConfigs(ctx context.Context, req *discoveryenginepb.ListServingConfigsRequest, opts ...gax.CallOption) *ServingConfigIteratorListServingConfigs lists all ServingConfigs linked to this dataStore.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListServingConfigsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListServingConfigsRequest. } it := c.ListServingConfigs(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.(*discoveryenginepb.ListServingConfigsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListServingConfigsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListServingConfigsRequest. } for resp, err := range c.ListServingConfigs(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*ServingConfigClient) UpdateServingConfig
func (c *ServingConfigClient) UpdateServingConfig(ctx context.Context, req *discoveryenginepb.UpdateServingConfigRequest, opts ...gax.CallOption) (*discoveryenginepb.ServingConfig, error)UpdateServingConfig updates a ServingConfig.
Returns a NOT_FOUND error if the ServingConfig does not exist.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewServingConfigClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateServingConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateServingConfigRequest. } resp, err := c.UpdateServingConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } ServingConfigIterator
type ServingConfigIterator 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 []*discoveryenginepb.ServingConfig, nextPageToken string, err error) // contains filtered or unexported fields }ServingConfigIterator manages a stream of *discoveryenginepb.ServingConfig.
func (*ServingConfigIterator) All
func (it *ServingConfigIterator) All() iter.Seq2[*discoveryenginepb.ServingConfig, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ServingConfigIterator) Next
func (it *ServingConfigIterator) Next() (*discoveryenginepb.ServingConfig, 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 (*ServingConfigIterator) PageInfo
func (it *ServingConfigIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SessionCallOptions
type SessionCallOptions struct { CreateSession []gax.CallOption DeleteSession []gax.CallOption UpdateSession []gax.CallOption GetSession []gax.CallOption ListSessions []gax.CallOption ListFiles []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }SessionCallOptions contains the retry settings for each method of SessionClient.
SessionClient
type SessionClient struct { // The call options for this service. CallOptions *SessionCallOptions // contains filtered or unexported fields }SessionClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing Sessions and Session-related resources.
func NewSessionClient
func NewSessionClient(ctx context.Context, opts ...option.ClientOption) (*SessionClient, error)NewSessionClient creates a new session service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing Sessions and Session-related resources.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewSessionRESTClient
func NewSessionRESTClient(ctx context.Context, opts ...option.ClientOption) (*SessionClient, error)NewSessionRESTClient creates a new session service rest client.
Service for managing Sessions and Session-related resources.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSessionRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*SessionClient) CancelOperation
func (c *SessionClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*SessionClient) Close
func (c *SessionClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SessionClient) Connection (deprecated)
func (c *SessionClient) 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 (*SessionClient) CreateSession
func (c *SessionClient) CreateSession(ctx context.Context, req *discoveryenginepb.CreateSessionRequest, opts ...gax.CallOption) (*discoveryenginepb.Session, error)CreateSession creates a Session.
If the Session to create already exists, an ALREADY_EXISTS error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateSessionRequest. } resp, err := c.CreateSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SessionClient) DeleteSession
func (c *SessionClient) DeleteSession(ctx context.Context, req *discoveryenginepb.DeleteSessionRequest, opts ...gax.CallOption) errorDeleteSession deletes a Session.
If the Session to delete does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteSessionRequest. } err = c.DeleteSession(ctx, req) if err != nil { // TODO: Handle error. } } func (*SessionClient) GetOperation
func (c *SessionClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SessionClient) GetSession
func (c *SessionClient) GetSession(ctx context.Context, req *discoveryenginepb.GetSessionRequest, opts ...gax.CallOption) (*discoveryenginepb.Session, error)GetSession gets a Session.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetSessionRequest. } resp, err := c.GetSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SessionClient) ListFiles
func (c *SessionClient) ListFiles(ctx context.Context, req *discoveryenginepb.ListFilesRequest, opts ...gax.CallOption) *FileMetadataIteratorListFiles lists metadata for all files in the current session.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListFilesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListFilesRequest. } it := c.ListFiles(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.(*discoveryenginepb.ListFilesResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListFilesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListFilesRequest. } for resp, err := range c.ListFiles(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SessionClient) ListOperations
func (c *SessionClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SessionClient) ListSessions
func (c *SessionClient) ListSessions(ctx context.Context, req *discoveryenginepb.ListSessionsRequest, opts ...gax.CallOption) *SessionIteratorListSessions lists all Sessions by their parent DataStore.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSessionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSessionsRequest. } it := c.ListSessions(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.(*discoveryenginepb.ListSessionsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListSessionsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListSessionsRequest. } for resp, err := range c.ListSessions(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SessionClient) UpdateSession
func (c *SessionClient) UpdateSession(ctx context.Context, req *discoveryenginepb.UpdateSessionRequest, opts ...gax.CallOption) (*discoveryenginepb.Session, error)UpdateSession updates a Session.
Session action type cannot be changed. If the Session to update does not exist, a NOT_FOUND error is returned.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSessionClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateSessionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateSessionRequest. } resp, err := c.UpdateSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } SessionIterator
type SessionIterator 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 []*discoveryenginepb.Session, nextPageToken string, err error) // contains filtered or unexported fields }SessionIterator manages a stream of *discoveryenginepb.Session.
func (*SessionIterator) All
func (it *SessionIterator) All() iter.Seq2[*discoveryenginepb.Session, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*SessionIterator) Next
func (it *SessionIterator) Next() (*discoveryenginepb.Session, 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 (*SessionIterator) PageInfo
func (it *SessionIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
SetUriPatternDocumentDataOperation
type SetUriPatternDocumentDataOperation struct { // contains filtered or unexported fields }SetUriPatternDocumentDataOperation manages a long-running operation from SetUriPatternDocumentData.
func (*SetUriPatternDocumentDataOperation) Done
func (op *SetUriPatternDocumentDataOperation) Done() boolDone reports whether the long-running operation has completed.
func (*SetUriPatternDocumentDataOperation) Metadata
func (op *SetUriPatternDocumentDataOperation) Metadata() (*discoveryenginepb.SetUriPatternDocumentDataMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*SetUriPatternDocumentDataOperation) Name
func (op *SetUriPatternDocumentDataOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*SetUriPatternDocumentDataOperation) Poll
func (op *SetUriPatternDocumentDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.SetUriPatternDocumentDataResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*SetUriPatternDocumentDataOperation) Wait
func (op *SetUriPatternDocumentDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.SetUriPatternDocumentDataResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
SiteSearchEngineCallOptions
type SiteSearchEngineCallOptions struct { GetSiteSearchEngine []gax.CallOption CreateTargetSite []gax.CallOption BatchCreateTargetSites []gax.CallOption GetTargetSite []gax.CallOption UpdateTargetSite []gax.CallOption DeleteTargetSite []gax.CallOption ListTargetSites []gax.CallOption EnableAdvancedSiteSearch []gax.CallOption DisableAdvancedSiteSearch []gax.CallOption RecrawlUris []gax.CallOption BatchVerifyTargetSites []gax.CallOption FetchDomainVerificationStatus []gax.CallOption SetUriPatternDocumentData []gax.CallOption GetUriPatternDocumentData []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }SiteSearchEngineCallOptions contains the retry settings for each method of SiteSearchEngineClient.
SiteSearchEngineClient
type SiteSearchEngineClient struct { // The call options for this service. CallOptions *SiteSearchEngineCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }SiteSearchEngineClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for managing site search related resources.
func NewSiteSearchEngineClient
func NewSiteSearchEngineClient(ctx context.Context, opts ...option.ClientOption) (*SiteSearchEngineClient, error)NewSiteSearchEngineClient creates a new site search engine service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for managing site search related resources.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewSiteSearchEngineRESTClient
func NewSiteSearchEngineRESTClient(ctx context.Context, opts ...option.ClientOption) (*SiteSearchEngineClient, error)NewSiteSearchEngineRESTClient creates a new site search engine service rest client.
Service for managing site search related resources.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewSiteSearchEngineRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*SiteSearchEngineClient) BatchCreateTargetSites
func (c *SiteSearchEngineClient) BatchCreateTargetSites(ctx context.Context, req *discoveryenginepb.BatchCreateTargetSitesRequest, opts ...gax.CallOption) (*BatchCreateTargetSitesOperation, error)BatchCreateTargetSites creates TargetSite in a batch.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.BatchCreateTargetSitesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#BatchCreateTargetSitesRequest. } op, err := c.BatchCreateTargetSites(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) BatchCreateTargetSitesOperation
func (c *SiteSearchEngineClient) BatchCreateTargetSitesOperation(name string) *BatchCreateTargetSitesOperationBatchCreateTargetSitesOperation returns a new BatchCreateTargetSitesOperation from a given name. The name must be that of a previously created BatchCreateTargetSitesOperation, possibly from a different process.
func (*SiteSearchEngineClient) BatchVerifyTargetSites
func (c *SiteSearchEngineClient) BatchVerifyTargetSites(ctx context.Context, req *discoveryenginepb.BatchVerifyTargetSitesRequest, opts ...gax.CallOption) (*BatchVerifyTargetSitesOperation, error)BatchVerifyTargetSites verify target sites’ ownership and validity. This API sends all the target sites under site search engine for verification.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.BatchVerifyTargetSitesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#BatchVerifyTargetSitesRequest. } op, err := c.BatchVerifyTargetSites(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) BatchVerifyTargetSitesOperation
func (c *SiteSearchEngineClient) BatchVerifyTargetSitesOperation(name string) *BatchVerifyTargetSitesOperationBatchVerifyTargetSitesOperation returns a new BatchVerifyTargetSitesOperation from a given name. The name must be that of a previously created BatchVerifyTargetSitesOperation, possibly from a different process.
func (*SiteSearchEngineClient) CancelOperation
func (c *SiteSearchEngineClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*SiteSearchEngineClient) Close
func (c *SiteSearchEngineClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SiteSearchEngineClient) Connection (deprecated)
func (c *SiteSearchEngineClient) 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 (*SiteSearchEngineClient) CreateTargetSite
func (c *SiteSearchEngineClient) CreateTargetSite(ctx context.Context, req *discoveryenginepb.CreateTargetSiteRequest, opts ...gax.CallOption) (*CreateTargetSiteOperation, error)CreateTargetSite creates a TargetSite.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CreateTargetSiteRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CreateTargetSiteRequest. } op, err := c.CreateTargetSite(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) CreateTargetSiteOperation
func (c *SiteSearchEngineClient) CreateTargetSiteOperation(name string) *CreateTargetSiteOperationCreateTargetSiteOperation returns a new CreateTargetSiteOperation from a given name. The name must be that of a previously created CreateTargetSiteOperation, possibly from a different process.
func (*SiteSearchEngineClient) DeleteTargetSite
func (c *SiteSearchEngineClient) DeleteTargetSite(ctx context.Context, req *discoveryenginepb.DeleteTargetSiteRequest, opts ...gax.CallOption) (*DeleteTargetSiteOperation, error)DeleteTargetSite deletes a TargetSite.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DeleteTargetSiteRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DeleteTargetSiteRequest. } op, err := c.DeleteTargetSite(ctx, req) if err != nil { // TODO: Handle error. } err = op.Wait(ctx) if err != nil { // TODO: Handle error. } } func (*SiteSearchEngineClient) DeleteTargetSiteOperation
func (c *SiteSearchEngineClient) DeleteTargetSiteOperation(name string) *DeleteTargetSiteOperationDeleteTargetSiteOperation returns a new DeleteTargetSiteOperation from a given name. The name must be that of a previously created DeleteTargetSiteOperation, possibly from a different process.
func (*SiteSearchEngineClient) DisableAdvancedSiteSearch
func (c *SiteSearchEngineClient) DisableAdvancedSiteSearch(ctx context.Context, req *discoveryenginepb.DisableAdvancedSiteSearchRequest, opts ...gax.CallOption) (*DisableAdvancedSiteSearchOperation, error)DisableAdvancedSiteSearch downgrade from advanced site search to basic site search.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.DisableAdvancedSiteSearchRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#DisableAdvancedSiteSearchRequest. } op, err := c.DisableAdvancedSiteSearch(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) DisableAdvancedSiteSearchOperation
func (c *SiteSearchEngineClient) DisableAdvancedSiteSearchOperation(name string) *DisableAdvancedSiteSearchOperationDisableAdvancedSiteSearchOperation returns a new DisableAdvancedSiteSearchOperation from a given name. The name must be that of a previously created DisableAdvancedSiteSearchOperation, possibly from a different process.
func (*SiteSearchEngineClient) EnableAdvancedSiteSearch
func (c *SiteSearchEngineClient) EnableAdvancedSiteSearch(ctx context.Context, req *discoveryenginepb.EnableAdvancedSiteSearchRequest, opts ...gax.CallOption) (*EnableAdvancedSiteSearchOperation, error)EnableAdvancedSiteSearch upgrade from basic site search to advanced site search.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.EnableAdvancedSiteSearchRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#EnableAdvancedSiteSearchRequest. } op, err := c.EnableAdvancedSiteSearch(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) EnableAdvancedSiteSearchOperation
func (c *SiteSearchEngineClient) EnableAdvancedSiteSearchOperation(name string) *EnableAdvancedSiteSearchOperationEnableAdvancedSiteSearchOperation returns a new EnableAdvancedSiteSearchOperation from a given name. The name must be that of a previously created EnableAdvancedSiteSearchOperation, possibly from a different process.
func (*SiteSearchEngineClient) FetchDomainVerificationStatus
func (c *SiteSearchEngineClient) FetchDomainVerificationStatus(ctx context.Context, req *discoveryenginepb.FetchDomainVerificationStatusRequest, opts ...gax.CallOption) *TargetSiteIteratorFetchDomainVerificationStatus returns list of target sites with its domain verification status. This method can only be called under data store with BASIC_SITE_SEARCH state at the moment.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.FetchDomainVerificationStatusRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#FetchDomainVerificationStatusRequest. } it := c.FetchDomainVerificationStatus(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.(*discoveryenginepb.FetchDomainVerificationStatusResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.FetchDomainVerificationStatusRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#FetchDomainVerificationStatusRequest. } for resp, err := range c.FetchDomainVerificationStatus(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SiteSearchEngineClient) GetOperation
func (c *SiteSearchEngineClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) GetSiteSearchEngine
func (c *SiteSearchEngineClient) GetSiteSearchEngine(ctx context.Context, req *discoveryenginepb.GetSiteSearchEngineRequest, opts ...gax.CallOption) (*discoveryenginepb.SiteSearchEngine, error)GetSiteSearchEngine gets the SiteSearchEngine.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetSiteSearchEngineRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetSiteSearchEngineRequest. } resp, err := c.GetSiteSearchEngine(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) GetTargetSite
func (c *SiteSearchEngineClient) GetTargetSite(ctx context.Context, req *discoveryenginepb.GetTargetSiteRequest, opts ...gax.CallOption) (*discoveryenginepb.TargetSite, error)GetTargetSite gets a TargetSite.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetTargetSiteRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetTargetSiteRequest. } resp, err := c.GetTargetSite(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) GetUriPatternDocumentData
func (c *SiteSearchEngineClient) GetUriPatternDocumentData(ctx context.Context, req *discoveryenginepb.GetUriPatternDocumentDataRequest, opts ...gax.CallOption) (*discoveryenginepb.GetUriPatternDocumentDataResponse, error)GetUriPatternDocumentData gets the URI Pattern to Document data mapping for an Advanced Site Search DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.GetUriPatternDocumentDataRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#GetUriPatternDocumentDataRequest. } resp, err := c.GetUriPatternDocumentData(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) ListOperations
func (c *SiteSearchEngineClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SiteSearchEngineClient) ListTargetSites
func (c *SiteSearchEngineClient) ListTargetSites(ctx context.Context, req *discoveryenginepb.ListTargetSitesRequest, opts ...gax.CallOption) *TargetSiteIteratorListTargetSites gets a list of TargetSites.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" "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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListTargetSitesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListTargetSitesRequest. } it := c.ListTargetSites(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.(*discoveryenginepb.ListTargetSitesResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ListTargetSitesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ListTargetSitesRequest. } for resp, err := range c.ListTargetSites(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*SiteSearchEngineClient) RecrawlUris
func (c *SiteSearchEngineClient) RecrawlUris(ctx context.Context, req *discoveryenginepb.RecrawlUrisRequest, opts ...gax.CallOption) (*RecrawlUrisOperation, error)RecrawlUris request on-demand recrawl for a list of URIs.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.RecrawlUrisRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#RecrawlUrisRequest. } op, err := c.RecrawlUris(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) RecrawlUrisOperation
func (c *SiteSearchEngineClient) RecrawlUrisOperation(name string) *RecrawlUrisOperationRecrawlUrisOperation returns a new RecrawlUrisOperation from a given name. The name must be that of a previously created RecrawlUrisOperation, possibly from a different process.
func (*SiteSearchEngineClient) SetUriPatternDocumentData
func (c *SiteSearchEngineClient) SetUriPatternDocumentData(ctx context.Context, req *discoveryenginepb.SetUriPatternDocumentDataRequest, opts ...gax.CallOption) (*SetUriPatternDocumentDataOperation, error)SetUriPatternDocumentData sets the URI Pattern to Document data mapping for an Advanced Site Search DataStore.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.SetUriPatternDocumentDataRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#SetUriPatternDocumentDataRequest. } op, err := c.SetUriPatternDocumentData(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) SetUriPatternDocumentDataOperation
func (c *SiteSearchEngineClient) SetUriPatternDocumentDataOperation(name string) *SetUriPatternDocumentDataOperationSetUriPatternDocumentDataOperation returns a new SetUriPatternDocumentDataOperation from a given name. The name must be that of a previously created SetUriPatternDocumentDataOperation, possibly from a different process.
func (*SiteSearchEngineClient) UpdateTargetSite
func (c *SiteSearchEngineClient) UpdateTargetSite(ctx context.Context, req *discoveryenginepb.UpdateTargetSiteRequest, opts ...gax.CallOption) (*UpdateTargetSiteOperation, error)UpdateTargetSite updates a TargetSite.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewSiteSearchEngineClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.UpdateTargetSiteRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#UpdateTargetSiteRequest. } op, err := c.UpdateTargetSite(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*SiteSearchEngineClient) UpdateTargetSiteOperation
func (c *SiteSearchEngineClient) UpdateTargetSiteOperation(name string) *UpdateTargetSiteOperationUpdateTargetSiteOperation returns a new UpdateTargetSiteOperation from a given name. The name must be that of a previously created UpdateTargetSiteOperation, possibly from a different process.
TargetSiteIterator
type TargetSiteIterator 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 []*discoveryenginepb.TargetSite, nextPageToken string, err error) // contains filtered or unexported fields }TargetSiteIterator manages a stream of *discoveryenginepb.TargetSite.
func (*TargetSiteIterator) All
func (it *TargetSiteIterator) All() iter.Seq2[*discoveryenginepb.TargetSite, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*TargetSiteIterator) Next
func (it *TargetSiteIterator) Next() (*discoveryenginepb.TargetSite, 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 (*TargetSiteIterator) PageInfo
func (it *TargetSiteIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
TrainCustomModelOperation
type TrainCustomModelOperation struct { // contains filtered or unexported fields }TrainCustomModelOperation manages a long-running operation from TrainCustomModel.
func (*TrainCustomModelOperation) Done
func (op *TrainCustomModelOperation) Done() boolDone reports whether the long-running operation has completed.
func (*TrainCustomModelOperation) Metadata
func (op *TrainCustomModelOperation) Metadata() (*discoveryenginepb.TrainCustomModelMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*TrainCustomModelOperation) Name
func (op *TrainCustomModelOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*TrainCustomModelOperation) Poll
func (op *TrainCustomModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TrainCustomModelResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*TrainCustomModelOperation) Wait
func (op *TrainCustomModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TrainCustomModelResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
TuneEngineOperation
type TuneEngineOperation struct { // contains filtered or unexported fields }TuneEngineOperation manages a long-running operation from TuneEngine.
func (*TuneEngineOperation) Done
func (op *TuneEngineOperation) Done() boolDone reports whether the long-running operation has completed.
func (*TuneEngineOperation) Metadata
func (op *TuneEngineOperation) Metadata() (*discoveryenginepb.TuneEngineMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*TuneEngineOperation) Name
func (op *TuneEngineOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*TuneEngineOperation) Poll
func (op *TuneEngineOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TuneEngineResponse, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*TuneEngineOperation) Wait
func (op *TuneEngineOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TuneEngineResponse, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UpdateSchemaOperation
type UpdateSchemaOperation struct { // contains filtered or unexported fields }UpdateSchemaOperation manages a long-running operation from UpdateSchema.
func (*UpdateSchemaOperation) Done
func (op *UpdateSchemaOperation) Done() boolDone reports whether the long-running operation has completed.
func (*UpdateSchemaOperation) Metadata
func (op *UpdateSchemaOperation) Metadata() (*discoveryenginepb.UpdateSchemaMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateSchemaOperation) Name
func (op *UpdateSchemaOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateSchemaOperation) Poll
func (op *UpdateSchemaOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateSchemaOperation) Wait
func (op *UpdateSchemaOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.Schema, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UpdateTargetSiteOperation
type UpdateTargetSiteOperation struct { // contains filtered or unexported fields }UpdateTargetSiteOperation manages a long-running operation from UpdateTargetSite.
func (*UpdateTargetSiteOperation) Done
func (op *UpdateTargetSiteOperation) Done() boolDone reports whether the long-running operation has completed.
func (*UpdateTargetSiteOperation) Metadata
func (op *UpdateTargetSiteOperation) Metadata() (*discoveryenginepb.UpdateTargetSiteMetadata, error)Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateTargetSiteOperation) Name
func (op *UpdateTargetSiteOperation) Name() stringName returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*UpdateTargetSiteOperation) Poll
func (op *UpdateTargetSiteOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TargetSite, error)Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*UpdateTargetSiteOperation) Wait
func (op *UpdateTargetSiteOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*discoveryenginepb.TargetSite, error)Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UserEventCallOptions
type UserEventCallOptions struct { WriteUserEvent []gax.CallOption CollectUserEvent []gax.CallOption PurgeUserEvents []gax.CallOption ImportUserEvents []gax.CallOption CancelOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }UserEventCallOptions contains the retry settings for each method of UserEventClient.
UserEventClient
type UserEventClient struct { // The call options for this service. CallOptions *UserEventCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }UserEventClient is a client for interacting with Discovery Engine API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for ingesting end user actions on a website to Discovery Engine API.
func NewUserEventClient
func NewUserEventClient(ctx context.Context, opts ...option.ClientOption) (*UserEventClient, error)NewUserEventClient creates a new user event service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for ingesting end user actions on a website to Discovery Engine API.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func NewUserEventRESTClient
func NewUserEventRESTClient(ctx context.Context, opts ...option.ClientOption) (*UserEventClient, error)NewUserEventRESTClient creates a new user event service rest client.
Service for ingesting end user actions on a website to Discovery Engine API.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" ) 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 := discoveryengine.NewUserEventRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c } func (*UserEventClient) CancelOperation
func (c *UserEventClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.CancelOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest. } err = c.CancelOperation(ctx, req) if err != nil { // TODO: Handle error. } } func (*UserEventClient) Close
func (c *UserEventClient) Close() errorClose closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*UserEventClient) CollectUserEvent
func (c *UserEventClient) CollectUserEvent(ctx context.Context, req *discoveryenginepb.CollectUserEventRequest, opts ...gax.CallOption) (*httpbodypb.HttpBody, error)CollectUserEvent writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a third-party domain.
This method is used only by the Discovery Engine API JavaScript pixel and Google Tag Manager. Users should not call this method directly.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.CollectUserEventRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#CollectUserEventRequest. } resp, err := c.CollectUserEvent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*UserEventClient) Connection (deprecated)
func (c *UserEventClient) 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 (*UserEventClient) GetOperation
func (c *UserEventClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.GetOperationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. } resp, err := c.GetOperation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*UserEventClient) ImportUserEvents
func (c *UserEventClient) ImportUserEvents(ctx context.Context, req *discoveryenginepb.ImportUserEventsRequest, opts ...gax.CallOption) (*ImportUserEventsOperation, error)ImportUserEvents bulk import of user events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events.
Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.ImportUserEventsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#ImportUserEventsRequest. } op, err := c.ImportUserEvents(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*UserEventClient) ImportUserEventsOperation
func (c *UserEventClient) ImportUserEventsOperation(name string) *ImportUserEventsOperationImportUserEventsOperation returns a new ImportUserEventsOperation from a given name. The name must be that of a previously created ImportUserEventsOperation, possibly from a different process.
func (*UserEventClient) ListOperations
func (c *UserEventClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } it := c.ListOperations(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp // If you need to access the underlying RPC response, // you can do so by casting the `Response` as below. // Otherwise, remove this line. Only populated after // first call to Next(). Not safe for concurrent access. _ = it.Response.(*longrunningpb.ListOperationsResponse) } } all
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &longrunningpb.ListOperationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest. } for resp, err := range c.ListOperations(ctx, req).All() { if err != nil { // TODO: Handle error and break/return/continue. Iteration will stop after any error. } // TODO: Use resp. _ = resp } } func (*UserEventClient) PurgeUserEvents
func (c *UserEventClient) PurgeUserEvents(ctx context.Context, req *discoveryenginepb.PurgeUserEventsRequest, opts ...gax.CallOption) (*PurgeUserEventsOperation, error)PurgeUserEvents deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.PurgeUserEventsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#PurgeUserEventsRequest. } op, err := c.PurgeUserEvents(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } func (*UserEventClient) PurgeUserEventsOperation
func (c *UserEventClient) PurgeUserEventsOperation(name string) *PurgeUserEventsOperationPurgeUserEventsOperation returns a new PurgeUserEventsOperation from a given name. The name must be that of a previously created PurgeUserEventsOperation, possibly from a different process.
func (*UserEventClient) WriteUserEvent
func (c *UserEventClient) WriteUserEvent(ctx context.Context, req *discoveryenginepb.WriteUserEventRequest, opts ...gax.CallOption) (*discoveryenginepb.UserEvent, error)WriteUserEvent writes a single user event.
Example
package main import ( "context" discoveryengine "cloud.google.com/go/discoveryengine/apiv1alpha" discoveryenginepb "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb" ) 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 := discoveryengine.NewUserEventClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &discoveryenginepb.WriteUserEventRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb#WriteUserEventRequest. } resp, err := c.WriteUserEvent(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }