Data Labeling API v1beta1 - Package cloud.google.com/go/datalabeling/apiv1beta1 (v0.3.0)

Package datalabeling is an auto-generated package for the Data Labeling API.

Public API for Google Cloud AI Data Labeling Service.

NOTE: This package is in beta. It is not stable, and may be subject to changes.

Example usage

To get started with this package, create a client.

ctx := context.Background()
c, err := datalabeling.NewClient(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()
c, err := datalabeling.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &datalabelingpb.CreateDatasetRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#CreateDatasetRequest.
}
resp, err := c.CreateDataset(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewClient 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.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

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

AnnotatedDatasetIterator

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

AnnotatedDatasetIterator manages a stream of *datalabelingpb.AnnotatedDataset.

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

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

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

AnnotationSpecSetIterator

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

AnnotationSpecSetIterator manages a stream of *datalabelingpb.AnnotationSpecSet.

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

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

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

CallOptions

type CallOptions struct {
	CreateDataset            []gax.CallOption
	GetDataset               []gax.CallOption
	ListDatasets             []gax.CallOption
	DeleteDataset            []gax.CallOption
	ImportData               []gax.CallOption
	ExportData               []gax.CallOption
	GetDataItem              []gax.CallOption
	ListDataItems            []gax.CallOption
	GetAnnotatedDataset      []gax.CallOption
	ListAnnotatedDatasets    []gax.CallOption
	DeleteAnnotatedDataset   []gax.CallOption
	LabelImage               []gax.CallOption
	LabelVideo               []gax.CallOption
	LabelText                []gax.CallOption
	GetExample               []gax.CallOption
	ListExamples             []gax.CallOption
	CreateAnnotationSpecSet  []gax.CallOption
	GetAnnotationSpecSet     []gax.CallOption
	ListAnnotationSpecSets   []gax.CallOption
	DeleteAnnotationSpecSet  []gax.CallOption
	CreateInstruction        []gax.CallOption
	GetInstruction           []gax.CallOption
	ListInstructions         []gax.CallOption
	DeleteInstruction        []gax.CallOption
	GetEvaluation            []gax.CallOption
	SearchEvaluations        []gax.CallOption
	SearchExampleComparisons []gax.CallOption
	CreateEvaluationJob      []gax.CallOption
	UpdateEvaluationJob      []gax.CallOption
	GetEvaluationJob         []gax.CallOption
	PauseEvaluationJob       []gax.CallOption
	ResumeEvaluationJob      []gax.CallOption
	DeleteEvaluationJob      []gax.CallOption
	ListEvaluationJobs       []gax.CallOption
}

CallOptions contains the retry settings for each method of Client.

Client

type Client struct {

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

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

Client is a client for interacting with Data Labeling API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service for the AI Platform Data Labeling API.

func NewClient

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

NewClient creates a new data labeling 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 the AI Platform Data Labeling API.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) Connection

func (c *Client) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*Client) CreateAnnotationSpecSet

CreateAnnotationSpecSet creates an annotation spec set by providing a set of labels.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.CreateAnnotationSpecSetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#CreateAnnotationSpecSetRequest.
	}
	resp, err := c.CreateAnnotationSpecSet(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) CreateDataset

CreateDataset creates dataset. If success return a Dataset resource.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.CreateDatasetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#CreateDatasetRequest.
	}
	resp, err := c.CreateDataset(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) CreateEvaluationJob

CreateEvaluationJob creates an evaluation job.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.CreateEvaluationJobRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#CreateEvaluationJobRequest.
	}
	resp, err := c.CreateEvaluationJob(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) CreateInstruction

CreateInstruction creates an instruction for how data should be labeled.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.CreateInstructionRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#CreateInstructionRequest.
	}
	op, err := c.CreateInstruction(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*Client) CreateInstructionOperation

func (c *Client) CreateInstructionOperation(name string) *CreateInstructionOperation

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

func (*Client) DeleteAnnotatedDataset

func (c *Client) DeleteAnnotatedDataset(ctx context.Context, req *datalabelingpb.DeleteAnnotatedDatasetRequest, opts ...gax.CallOption) error

DeleteAnnotatedDataset deletes an annotated dataset by resource name.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.DeleteAnnotatedDatasetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#DeleteAnnotatedDatasetRequest.
	}
	err = c.DeleteAnnotatedDataset(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*Client) DeleteAnnotationSpecSet

func (c *Client) DeleteAnnotationSpecSet(ctx context.Context, req *datalabelingpb.DeleteAnnotationSpecSetRequest, opts ...gax.CallOption) error

DeleteAnnotationSpecSet deletes an annotation spec set by resource name.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.DeleteAnnotationSpecSetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#DeleteAnnotationSpecSetRequest.
	}
	err = c.DeleteAnnotationSpecSet(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*Client) DeleteDataset

func (c *Client) DeleteDataset(ctx context.Context, req *datalabelingpb.DeleteDatasetRequest, opts ...gax.CallOption) error

DeleteDataset deletes a dataset by resource name.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.DeleteDatasetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#DeleteDatasetRequest.
	}
	err = c.DeleteDataset(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*Client) DeleteEvaluationJob

func (c *Client) DeleteEvaluationJob(ctx context.Context, req *datalabelingpb.DeleteEvaluationJobRequest, opts ...gax.CallOption) error

DeleteEvaluationJob stops and deletes an evaluation job.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.DeleteEvaluationJobRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#DeleteEvaluationJobRequest.
	}
	err = c.DeleteEvaluationJob(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*Client) DeleteInstruction

func (c *Client) DeleteInstruction(ctx context.Context, req *datalabelingpb.DeleteInstructionRequest, opts ...gax.CallOption) error

DeleteInstruction deletes an instruction object by resource name.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.DeleteInstructionRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#DeleteInstructionRequest.
	}
	err = c.DeleteInstruction(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*Client) ExportData

ExportData exports data and annotations from dataset.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.ExportDataRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#ExportDataRequest.
	}
	op, err := c.ExportData(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*Client) ExportDataOperation

func (c *Client) ExportDataOperation(name string) *ExportDataOperation

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

func (*Client) GetAnnotatedDataset

GetAnnotatedDataset gets an annotated dataset by resource name.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.GetAnnotatedDatasetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#GetAnnotatedDatasetRequest.
	}
	resp, err := c.GetAnnotatedDataset(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetAnnotationSpecSet

GetAnnotationSpecSet gets an annotation spec set by resource name.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.GetAnnotationSpecSetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#GetAnnotationSpecSetRequest.
	}
	resp, err := c.GetAnnotationSpecSet(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetDataItem

GetDataItem gets a data item in a dataset by resource name. This API can be called after data are imported into dataset.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.GetDataItemRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#GetDataItemRequest.
	}
	resp, err := c.GetDataItem(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetDataset

GetDataset gets dataset by resource name.

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.GetDatasetRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#GetDatasetRequest.
	}
	resp, err := c.GetDataset(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetEvaluation

GetEvaluation gets an evaluation by resource name (to search, use projects.evaluations.search).

Example

package main

import (
	"context"

	datalabeling "cloud.google.com/go/datalabeling/apiv1beta1"

	datalabelingpb "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := datalabeling.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &datalabelingpb.GetEvaluationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1#GetEvaluationRequest.
	}
	resp, err := c.GetEvaluation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*Client) GetEvaluationJob