Vision AI API v1 - Package cloud.google.com/go/visionai/apiv1 (v0.3.0)

Package visionai is an auto-generated package for the Vision AI API.

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:

Example usage

To get started with this package, create a client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := visionai.NewLiveVideoAnalyticsClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &visionaipb.BatchRunProcessRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#BatchRunProcessRequest.
}
op, err := c.BatchRunProcess(ctx, req)
if err != nil {
    // TODO: Handle error.
}

resp, err := op.Wait(ctx)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewLiveVideoAnalyticsClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

AddApplicationStreamInputOperation

type AddApplicationStreamInputOperation struct {
	// contains filtered or unexported fields
}

AddApplicationStreamInputOperation manages a long-running operation from AddApplicationStreamInput.

func (*AddApplicationStreamInputOperation) Done

Done reports whether the long-running operation has completed.

func (*AddApplicationStreamInputOperation) Metadata

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 (*AddApplicationStreamInputOperation) Name

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*AddApplicationStreamInputOperation) Poll

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 (*AddApplicationStreamInputOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

AnalysisIterator

type AnalysisIterator 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 []*visionaipb.Analysis, nextPageToken string, err error)
	// contains filtered or unexported fields
}

AnalysisIterator manages a stream of *visionaipb.Analysis.

func (*AnalysisIterator) All

func (it *AnalysisIterator) All() iter.Seq2[*visionaipb.Analysis, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*AnalysisIterator) Next

func (it *AnalysisIterator) Next() (*visionaipb.Analysis, 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 (*AnalysisIterator) PageInfo

func (it *AnalysisIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

AnalyzeAssetOperation

type AnalyzeAssetOperation struct {
	// contains filtered or unexported fields
}

AnalyzeAssetOperation manages a long-running operation from AnalyzeAsset.

func (*AnalyzeAssetOperation) Done

func (op *AnalyzeAssetOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*AnalyzeAssetOperation) Metadata

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 (*AnalyzeAssetOperation) Name

func (op *AnalyzeAssetOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*AnalyzeAssetOperation) Poll

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 (*AnalyzeAssetOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

AnalyzeCorpusOperation

type AnalyzeCorpusOperation struct {
	// contains filtered or unexported fields
}

AnalyzeCorpusOperation manages a long-running operation from AnalyzeCorpus.

func (*AnalyzeCorpusOperation) Done

func (op *AnalyzeCorpusOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*AnalyzeCorpusOperation) Metadata

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 (*AnalyzeCorpusOperation) Name

func (op *AnalyzeCorpusOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*AnalyzeCorpusOperation) Poll

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 (*AnalyzeCorpusOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

AnnotationIterator

type AnnotationIterator 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 []*visionaipb.Annotation, nextPageToken string, err error)
	// contains filtered or unexported fields
}

AnnotationIterator manages a stream of *visionaipb.Annotation.

func (*AnnotationIterator) All

func (it *AnnotationIterator) All() iter.Seq2[*visionaipb.Annotation, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

func (*AnnotationIterator) Next

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 (*AnnotationIterator) PageInfo

func (it *AnnotationIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

AppPlatformCallOptions

type AppPlatformCallOptions struct {
	ListApplications             []gax.CallOption
	GetApplication               []gax.CallOption
	CreateApplication            []gax.CallOption
	UpdateApplication            []gax.CallOption
	DeleteApplication            []gax.CallOption
	DeployApplication            []gax.CallOption
	UndeployApplication          []gax.CallOption
	AddApplicationStreamInput    []gax.CallOption
	RemoveApplicationStreamInput []gax.CallOption
	UpdateApplicationStreamInput []gax.CallOption
	ListInstances                []gax.CallOption
	GetInstance                  []gax.CallOption
	CreateApplicationInstances   []gax.CallOption
	DeleteApplicationInstances   []gax.CallOption
	UpdateApplicationInstances   []gax.CallOption
	ListDrafts                   []gax.CallOption
	GetDraft                     []gax.CallOption
	CreateDraft                  []gax.CallOption
	UpdateDraft                  []gax.CallOption
	DeleteDraft                  []gax.CallOption
	ListProcessors               []gax.CallOption
	ListPrebuiltProcessors       []gax.CallOption
	GetProcessor                 []gax.CallOption
	CreateProcessor              []gax.CallOption
	UpdateProcessor              []gax.CallOption
	DeleteProcessor              []gax.CallOption
	CancelOperation              []gax.CallOption
	DeleteOperation              []gax.CallOption
	GetOperation                 []gax.CallOption
	ListOperations               []gax.CallOption
}

AppPlatformCallOptions contains the retry settings for each method of AppPlatformClient.

AppPlatformClient

type AppPlatformClient struct {

	// The call options for this service.
	CallOptions *AppPlatformCallOptions

	// 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
}

AppPlatformClient is a client for interacting with Vision AI API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service describing handlers for resources

func NewAppPlatformClient

func NewAppPlatformClient(ctx context.Context, opts ...option.ClientOption) (*AppPlatformClient, error)

NewAppPlatformClient creates a new app platform client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service describing handlers for resources

Example

package main

import (
	"context"

	visionai "cloud.google.com/go/visionai/apiv1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := visionai.NewAppPlatformClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewAppPlatformRESTClient

func NewAppPlatformRESTClient(ctx context.Context, opts ...option.ClientOption) (*AppPlatformClient, error)

NewAppPlatformRESTClient creates a new app platform rest client.

Service describing handlers for resources

Example

package main

import (
	"context"

	visionai "cloud.google.com/go/visionai/apiv1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := visionai.NewAppPlatformRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*AppPlatformClient) AddApplicationStreamInput

AddApplicationStreamInput adds target stream input to the Application. If the Application is deployed, the corresponding new Application instance will be created. If the stream has already been in the Application, the RPC will fail.

Example

package main

import (
	"context"

	visionai "cloud.google.com/go/visionai/apiv1"

	visionaipb "cloud.google.com/go/visionai/apiv1/visionaipb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := visionai.NewAppPlatformClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &visionaipb.AddApplicationStreamInputRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/visionai/apiv1/visionaipb#AddApplicationStreamInputRequest.
	}
	op, err := c.AddApplicationStreamInput(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AppPlatformClient) AddApplicationStreamInputOperation

func (c *AppPlatformClient) AddApplicationStreamInputOperation(name string) *AddApplicationStreamInputOperation

AddApplicationStreamInputOperation returns a new AddApplicationStreamInputOperation from a given name. The name must be that of a previously created AddApplicationStreamInputOperation, possibly from a different process.

func (*AppPlatformClient) CancelOperation

func (c *AppPlatformClient) CancelOperation(ctx