app

package
v0.123.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2026 License: AGPL-3.0 Imports: 33 Imported by: 1

Documentation

Overview

Package app contains the interfaces that manage a machine fleet with code instead of with the graphical interface of the Viam App.

Package app contains a gRPC based data client.

Package app contains all logic needed for communication and interaction with app.

Index

Constants

View Source
const (
	// AuthResourceTypeOrganization represents an organization authorization type.
	AuthResourceTypeOrganization = "organization"
	// AuthResourceTypeLocation represents a location authorization type.
	AuthResourceTypeLocation = "location"
	// AuthResourceTypeRobot represents a robot authorization type.
	AuthResourceTypeRobot = "robot"
)
View Source
const (
	UploadChunkSize = 64 * 1024 // UploadChunkSize is 64 KB
)

Constants used throughout app.

Variables

This section is empty.

Functions

func BsonToGo added in v0.52.0

func BsonToGo(rawData [][]byte) ([]map[string]interface{}, error)

BsonToGo converts raw BSON data (as [][]byte) into native Go types and interfaces. Returns a slice of maps representing the data objects.

func ConvertImageToBytes added in v0.90.0

func ConvertImageToBytes(image image.Image, mimeType MimeType) ([]byte, error)

ConvertImageToBytes converts an image.Image to a byte slice based on the specified MIME type.

Types

type APIKey added in v0.53.0

type APIKey struct {
	ID        string `json:"id"`
	Key       string `json:"key"`
	Name      string
	CreatedOn *time.Time
}

APIKey is a API key to make a request to an API.

type APIKeyAuthorization added in v0.53.0

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

APIKeyAuthorization is a struct with the necessary authorization data to create an API key.

type APIKeyWithAuthorizations added in v0.53.0

type APIKeyWithAuthorizations struct {
	APIKey         *APIKey
	Authorizations []*AuthorizationDetails
}

APIKeyWithAuthorizations is an API Key with its authorizations.

type Annotations added in v0.52.0

type Annotations struct {
	Bboxes          []*BoundingBox
	Classifications []*Classification
}

Annotations are data annotations used for machine learning.

type App added in v0.76.0

type App struct {
	Name       string
	Type       string
	Entrypoint string
}

App holds the information of an viam app.

type AppBranding added in v0.110.0

type AppBranding struct {
	LogoPath           string
	TextCustomizations map[string]TextOverrides
	FragmentIDs        []string
	AllowedOrgIDs      []string
}

AppBranding contains metadata relevant to Viam Apps customizations.

type AppClient added in v0.53.0

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

AppClient is a gRPC client for method calls to the App API.

func (*AppClient) AddRole added in v0.53.0

func (c *AppClient) AddRole(
	ctx context.Context, orgID, identityID string, role AuthRole, resourceType AuthResourceType, resourceID string,
) error

AddRole creates an identity authorization.

func (*AppClient) ChangeRole added in v0.53.0

func (c *AppClient) ChangeRole(
	ctx context.Context,
	oldAuthorization *Authorization,
	newOrgID,
	newIdentityID string,
	newRole AuthRole,
	newResourceType AuthResourceType,
	newResourceID string,
) error

ChangeRole changes an identity authorization to a new identity authorization.

func (*AppClient) CheckPermissions added in v0.53.0

func (c *AppClient) CheckPermissions(ctx context.Context, permissions []*AuthorizedPermissions) ([]*AuthorizedPermissions, error)

CheckPermissions checks the validity of a list of permissions.

CheckPermissions example:

err := cloud.CheckPermissions(
	context.Background(),
	[]*app.AuthorizedPermissions{
		{
			ResourceType: app.AuthResourceTypeLocation,
			ResourceID:   "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
			Permissions:  []string{"control_robot", "read_robot_logs"},
		},
	},
)

For more information, see the CheckPermissions method docs.

func (*AppClient) CreateFragment added in v0.53.0

func (c *AppClient) CreateFragment(
	ctx context.Context, orgID, name string, config map[string]interface{}, opts *CreateFragmentOptions,
) (*Fragment, error)

CreateFragment creates a fragment.

CreateFragment example:

fragmentConfig := map[string]interface{}{
	"components": []map[string]interface{}{
		{
			"name":       "camera-1",
			"api":        "rdk:component:camera",
			"model":      "rdk:builtin:fake",
			"attributes": map[string]interface{}{},
		},
	},
}

fragment, err := cloud.CreateFragment(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"My Fragment",
	fragmentConfig,
	&app.CreateFragmentOptions{Visibility: &app.FragmentVisibilityPublic},
)

For more information, see the CreateFragment method docs.

func (*AppClient) CreateKey added in v0.53.0

func (c *AppClient) CreateKey(
	ctx context.Context, orgID string, keyAuthorizations []APIKeyAuthorization, name string,
) (string, string, error)

CreateKey creates a new API key associated with a list of authorizations and returns its key and ID.

func (*AppClient) CreateKeyFromExistingKeyAuthorizations added in v0.53.0

func (c *AppClient) CreateKeyFromExistingKeyAuthorizations(ctx context.Context, id string) (string, string, error)

CreateKeyFromExistingKeyAuthorizations creates a new API key with an existing key's authorizations and returns its ID and key.

CreateKeyFromExistingKeyAuthorizations example:

id, key, err := cloud.CreateKeyFromExistingKeyAuthorizations(context.Background(), "a1bcdefghi2jklmnopqrstuvw3xyzabc")

For more information, see the CreateKeyFromExistingKeyAuthorizations method docs.

func (*AppClient) CreateLocation added in v0.53.0

func (c *AppClient) CreateLocation(ctx context.Context, orgID, name string, opts *CreateLocationOptions) (*Location, error)

CreateLocation creates a location with the given name under the given organization.

CreateLocation example:

 locationID := "ab1c2d3e45"
	err := cloud.CreateLocation(
		context.Background(),
		"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
		"test-location",
		&app.CreateLocationOptions{
			ParentLocationID: &locationID,
	})

For more information, see the CreateLocation method docs.

func (*AppClient) CreateLocationSecret added in v0.53.0

func (c *AppClient) CreateLocationSecret(ctx context.Context, locationID string) (*LocationAuth, error)

CreateLocationSecret creates a new generated secret in the location. Succeeds if there are no more than 2 active secrets after creation.

CreateLocationSecret example:

auth, err := cloud.CreateLocationSecret(context.Background(), "ab1c2d3e45")

For more information, see the CreateLocationSecret method docs.

func (*AppClient) CreateModule added in v0.53.0

func (c *AppClient) CreateModule(ctx context.Context, orgID, name string) (string, string, error)

CreateModule creates a module and returns its ID and URL.

CreateModule example:

moduleID, url, err := cloud.CreateModule(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"module_name",
)

For more information, see the CreateModule method docs.

func (*AppClient) CreateOrganization added in v0.53.0

func (c *AppClient) CreateOrganization(ctx context.Context, name string) (*Organization, error)

CreateOrganization creates a new organization.

CreateOrganization example:

organization, err := cloud.CreateOrganization(context.Background(), "testOrganization")

For more information, see the CreateOrganization method docs.

func (*AppClient) CreateOrganizationInvite added in v0.53.0

func (c *AppClient) CreateOrganizationInvite(
	ctx context.Context, orgID, email string, authorizations []*Authorization, opts *CreateOrganizationInviteOptions,
) (*OrganizationInvite, error)

CreateOrganizationInvite creates an organization invite to an organization.

CreateOrganizationInvite example:

func boolPtr(b bool) *bool {
	return &b
}

invite, err := cloud.CreateOrganizationInvite(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"test@example.com",
	[]*Authorization{&Authorization{}},
	&app.CreateOrganizationInviteOptions{
		SendEmailInvite: boolPtr(true),
	})

For more information, see the CreateOrganizationInvite method docs.

func (*AppClient) CreateRegistryItem added in v0.53.0

func (c *AppClient) CreateRegistryItem(ctx context.Context, orgID, name string, packageType PackageType) error

CreateRegistryItem creates a registry item.

CreateRegistryItem example:

err := cloud.CreateRegistryItem(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"registry_item_name",
	app.PackageTypeMLModel)

For more information, see the CreateRegistryItem method docs.

func (*AppClient) CreateRobotPartSecret added in v0.53.0

func (c *AppClient) CreateRobotPartSecret(ctx context.Context, partID string) (*RobotPart, error)

CreateRobotPartSecret creates a new generated secret in the robot part. Succeeds if there are no more than 2 active secrets after creation.

CreateRobotPartSecret example:

part, err := cloud.CreateRobotPartSecret(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the CreateRobotPartSecret method docs.

func (*AppClient) DeleteFragment added in v0.53.0

func (c *AppClient) DeleteFragment(ctx context.Context, id string) error

DeleteFragment deletes a fragment.

DeleteFragment example:

err := cloud.DeleteFragment(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the DeleteFragment method docs.

func (*AppClient) DeleteKey added in v0.53.0

func (c *AppClient) DeleteKey(ctx context.Context, id string) error

DeleteKey deletes an API key.

DeleteKey example:

err := cloud.DeleteKey(context.Background(), "a1bcdefghi2jklmnopqrstuvw3xyzabc")

For more information, see the DeleteKey method docs.

func (*AppClient) DeleteLocation added in v0.53.0

func (c *AppClient) DeleteLocation(ctx context.Context, locationID string) error

DeleteLocation deletes a location.

DeleteLocation example:

err := cloud.DeleteLocation(context.Background(), "ab1c2d3e45")

For more information, see the DeleteLocation method docs.

func (*AppClient) DeleteLocationSecret added in v0.53.0

func (c *AppClient) DeleteLocationSecret(ctx context.Context, locationID, secretID string) error

DeleteLocationSecret deletes a secret from the location.

DeleteLocationSecret example:

err := cloud.DeleteLocationSecret(
	context.Background(),
	"ab1c2d3e45",
	"a12bcd3e-a12b-1234-1ab2-abc123d4e5f6")
)

For more information, see the DeleteLocationSecret method docs.

func (*AppClient) DeleteOrganization added in v0.53.0

func (c *AppClient) DeleteOrganization(ctx context.Context, orgID string) error

DeleteOrganization deletes an organization.

DeleteOrganization example:

err := cloud.DeleteOrganization(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the DeleteOrganization method docs.

func (*AppClient) DeleteOrganizationInvite added in v0.53.0

func (c *AppClient) DeleteOrganizationInvite(ctx context.Context, orgID, email string) error

DeleteOrganizationInvite deletes an organization invite.

DeleteOrganizationInvite example:

err := cloud.DeleteOrganizationInvite(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"test@example.com")

For more information, see the DeleteOrganizationInvite method docs.

func (*AppClient) DeleteOrganizationMember added in v0.53.0

func (c *AppClient) DeleteOrganizationMember(ctx context.Context, orgID, userID string) error

DeleteOrganizationMember deletes an organization member from an organization.

DeleteOrganizationMember example:

err := cloud.DeleteOrganizationMember(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"1234a56b-1234-1a23-1234-a12bcd3ef4a5")

For more information, see the DeleteOrganizationMember method docs.

func (*AppClient) DeleteRegistryItem added in v0.53.0

func (c *AppClient) DeleteRegistryItem(ctx context.Context, itemID string) error

DeleteRegistryItem deletes a registry item given an ID that is formatted as `prefix:name" where `prefix" is the owner's organization ID or namespace.

DeleteRegistryItem example:

err := cloud.DeleteRegistryItem(context.Background(), "namespace:name")

For more information, see the DeleteRegistryItem method docs.

func (*AppClient) DeleteRobot added in v0.53.0

func (c *AppClient) DeleteRobot(ctx context.Context, id string) error

DeleteRobot deletes a robot.

DeleteRobot example:

err := cloud.DeleteRobot(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the DeleteRobot method docs.

func (*AppClient) DeleteRobotPart added in v0.53.0

func (c *AppClient) DeleteRobotPart(ctx context.Context, partID string) error

DeleteRobotPart deletes a robot part.

DeleteRobotPart example:

err := cloud.DeleteRobotPart(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the DeleteRobotPart method docs.

func (*AppClient) DeleteRobotPartSecret added in v0.53.0

func (c *AppClient) DeleteRobotPartSecret(ctx context.Context, partID, secretID string) error

DeleteRobotPartSecret deletes a secret from the robot part.

DeleteRobotPartSecret example:

err := cloud.DeleteRobotPartSecret(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12",
	"a12bcd34-1234-12ab-1ab2-123a4567890b")

For more information, see the DeleteRobotPartSecret method docs.

func (*AppClient) DisableBillingService added in v0.53.0

func (c *AppClient) DisableBillingService(ctx context.Context, orgID string) error

DisableBillingService disables the billing service for an organization.

DisableBillingService example:

err := cloud.DisableBillingService(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the DisableBillingService method docs.

func (*AppClient) EnableBillingService added in v0.53.0

func (c *AppClient) EnableBillingService(ctx context.Context, orgID string, billingAddress *BillingAddress) error

EnableBillingService enables a billing service to an address in an organization.

func (*AppClient) GetAppBranding added in v0.110.0

func (c *AppClient) GetAppBranding(ctx context.Context, orgPublicNamespace, appName string) (*AppBranding, error)

GetAppBranding gets the branding for an app.

GetAppBranding example:

branding, err := cloud.GetAppBranding(context.Background(), "my-org", "my-app")

For more information, see the GetAppBranding method docs.

func (*AppClient) GetAppContent added in v0.110.0

func (c *AppClient) GetAppContent(ctx context.Context, orgPublicNamespace, appName string) (*AppContent, error)

GetAppContent gets the content for an app.

GetAppContent example:

content, err := cloud.GetAppContent(context.Background(), "my-org", "my-app")

For more information, see the GetAppContent method docs.

func (*AppClient) GetBillingServiceConfig added in v0.54.0

func (c *AppClient) GetBillingServiceConfig(ctx context.Context, orgID string) (*pb.GetBillingServiceConfigResponse, error)

GetBillingServiceConfig gets the billing service configuration for an organization.

GetBillingServiceConfig example:

config, err := cloud.GetBillingServiceConfig(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the GetBillingServiceConfig method docs.

func (*AppClient) GetFragment added in v0.53.0

func (c *AppClient) GetFragment(ctx context.Context, id, version string) (*Fragment, error)

GetFragment gets a single fragment.

GetFragment example:

fragment, err := cloud.GetFragment(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2", "")

For more information, see the GetFragment method docs.

func (*AppClient) GetFragmentHistory added in v0.53.0

func (c *AppClient) GetFragmentHistory(
	ctx context.Context, id string, opts *GetFragmentHistoryOptions,
) ([]*FragmentHistoryEntry, string, error)

GetFragmentHistory gets the fragment's history and the next page token.

GetFragmentHistory example:

 limit := 10
	history, token, err := cloud.GetFragmentHistory(
		context.Background(),
		"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
		&app.GetFragmentHistoryOptions{PageLimit: &limit})

For more information, see the GetFragmentHistory method docs.

func (*AppClient) GetLocation added in v0.53.0

func (c *AppClient) GetLocation(ctx context.Context, locationID string) (*Location, error)

GetLocation gets a location.

GetLocation example:

location, err := cloud.GetLocation(context.Background(), "ab1c2d3e45")

For more information, see the GetLocation method docs.

func (*AppClient) GetLocationMetadata added in v0.67.0

func (c *AppClient) GetLocationMetadata(ctx context.Context, locationID string) (map[string]interface{}, error)

GetLocationMetadata gets the user-defined metadata for a location.

GetLocationMetadata example:

metadata, err := cloud.GetLocationMetadata(context.Background(), "ab1c2d3e45")

For more information, see the GetLocationMetadata method docs.

func (*AppClient) GetModule added in v0.53.0

func (c *AppClient) GetModule(ctx context.Context, moduleID string) (*Module, error)

GetModule gets a module.

GetModule example:

module, err := cloud.GetModule(context.Background(), "namespace:name")

For more information, see the GetModule method docs.

func (*AppClient) GetOrganization added in v0.53.0

func (c *AppClient) GetOrganization(ctx context.Context, orgID string) (*Organization, error)

GetOrganization gets an organization.

GetOrganization example:

organization, err := cloud.GetOrganization(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the GetOrganization method docs.

func (*AppClient) GetOrganizationMetadata added in v0.67.0

func (c *AppClient) GetOrganizationMetadata(ctx context.Context, organizationID string) (map[string]interface{}, error)

GetOrganizationMetadata gets the user-defined metadata for an organization.

GetOrganizationMetadata example:

metadata, err := cloud.GetOrganizationMetadata(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the GetOrganizationMetadata method docs.

func (*AppClient) GetOrganizationNamespaceAvailability added in v0.53.0

func (c *AppClient) GetOrganizationNamespaceAvailability(ctx context.Context, namespace string) (bool, error)

GetOrganizationNamespaceAvailability checks for namespace availability throughout all organizations.

GetOrganizationNamespaceAvailability example:

available, err := cloud.GetOrganizationNamespaceAvailability(context.Background(), "test-namespace")

For more information, see the GetOrganizationNamespaceAvailability method docs.

func (*AppClient) GetOrganizationsWithAccessToLocation added in v0.53.0

func (c *AppClient) GetOrganizationsWithAccessToLocation(ctx context.Context, locationID string) ([]*OrganizationIdentity, error)

GetOrganizationsWithAccessToLocation gets all the organizations that have access to a location.

GetOrganizationsWithAccessToLocation example:

organizations, err := cloud.GetOrganizationsWithAccessToLocation(context.Background(), "ab1c2d3e45")

For more information, see the GetOrganizationsWithAccessToLocation method docs.

func (*AppClient) GetRegistryItem added in v0.53.0

func (c *AppClient) GetRegistryItem(ctx context.Context, itemID string) (*RegistryItem, error)

GetRegistryItem gets a registry item.

GetRegistryItem example:

registryItem, err := cloud.GetRegistryItem(context.Background(), "namespace:name")

For more information, see the GetRegistryItem method docs.

func (*AppClient) GetRobot added in v0.53.0

func (c *AppClient) GetRobot(ctx context.Context, id string) (*Robot, error)

GetRobot gets a specific robot by ID.

GetRobot example:

robot, err := cloud.GetRobot(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the GetRobot method docs.

func (*AppClient) GetRobotAPIKeys added in v0.53.0

func (c *AppClient) GetRobotAPIKeys(ctx context.Context, robotID string) ([]*APIKeyWithAuthorizations, error)

GetRobotAPIKeys gets the robot API keys for the robot.

GetRobotAPIKeys example:

keys, err := cloud.GetRobotAPIKeys(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the GetRobotAPIKeys method docs.

func (*AppClient) GetRobotMetadata added in v0.67.0

func (c *AppClient) GetRobotMetadata(ctx context.Context, robotID string) (map[string]interface{}, error)

GetRobotMetadata gets the user-defined metadata for a robot.

GetRobotMetadata example:

metadata, err := cloud.GetRobotMetadata(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the GetRobotMetadata method docs.

func (*AppClient) GetRobotPart added in v0.53.0

func (c *AppClient) GetRobotPart(ctx context.Context, id string) (*RobotPart, string, error)

GetRobotPart gets a specific robot part and its config by ID.

GetRobotPart example:

part, config, err := cloud.GetRobotPart(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12",
)

For more information, see the GetRobotPart method docs.

func (*AppClient) GetRobotPartByNameAndLocation added in v0.110.0

func (c *AppClient) GetRobotPartByNameAndLocation(ctx context.Context, name, locationID string) (*RobotPart, error)

GetRobotPartByNameAndLocation gets a robot part by name and location.

GetRobotPartByNameAndLocation example:

robotPart, err := cloud.GetRobotPartByNameAndLocation(context.Background(), "my-robot-main", "ab1c2d3e45")

For more information, see the GetRobotPartByNameAndLocation method docs.

func (*AppClient) GetRobotPartHistory added in v0.53.0

func (c *AppClient) GetRobotPartHistory(ctx context.Context, id string) ([]*RobotPartHistoryEntry, error)

GetRobotPartHistory gets a specific robot part history by ID.

GetRobotPartHistory example:

history, err := cloud.GetRobotPartHistory(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the GetRobotPartHistory method docs.

func (*AppClient) GetRobotPartLogs added in v0.53.0

func (c *AppClient) GetRobotPartLogs(ctx context.Context, id string, opts *GetRobotPartLogsOptions) ([]*LogEntry, string, error)

GetRobotPartLogs gets the logs associated with a robot part and the next page token.

GetRobotPartLogs example:

	filter := ""
	pageToken := ""
	startTime := time.Now().Add(-720 * time.Hour)
	endTime := time.Now()
	limit := 5
	source := ""
	partLogs, _, err := cloud.GetRobotPartLogs(
        ctx,
        PART_ID,
       &GetRobotPartLogsOptions{
			Filter: &filter,
			PageToken: &pageToken,
			Levels: []string{"INFO", "WARN", "ERROR"},
			Start: &startTime,
			End: &endTime,
			Limit: &limit,
			Source: &source,
		},
	)

For more information, see the GetRobotPartLogs method docs.

func (*AppClient) GetRobotPartMetadata added in v0.67.0

func (c *AppClient) GetRobotPartMetadata(ctx context.Context, robotID string) (map[string]interface{}, error)

GetRobotPartMetadata gets the user-defined metadata for a robot part.

GetRobotPartMetadata example:

metadata, err := cloud.GetRobotPartMetadata(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the GetRobotPartMetadata method docs.

func (*AppClient) GetRobotParts added in v0.53.0

func (c *AppClient) GetRobotParts(ctx context.Context, robotID string) ([]*RobotPart, error)

GetRobotParts gets a list of all the parts under a specific machine.

GetRobotParts example:

parts, err := cloud.GetRobotParts(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the GetRobotParts method docs.

func (*AppClient) GetRoverRentalRobots added in v0.53.0

func (c *AppClient) GetRoverRentalRobots(ctx context.Context, orgID string) ([]*RoverRentalRobot, error)

GetRoverRentalRobots gets rover rental robots within an organization.

func (*AppClient) GetUserIDByEmail added in v0.53.0

func (c *AppClient) GetUserIDByEmail(ctx context.Context, email string) (string, error)

GetUserIDByEmail gets the ID of the user with the given email.

GetUserIDByEmail example:

userID, err := cloud.GetUserIDByEmail(context.Background(), "test@example.com")

For more information, see the GetUserIDByEmail method docs.

func (*AppClient) ListAuthorizations added in v0.53.0

func (c *AppClient) ListAuthorizations(ctx context.Context, orgID string, resourceIDs []string) ([]*Authorization, error)

ListAuthorizations returns all authorization roles for any given resources. If no resources are given, all resources within the organization will be included.

ListAuthorizations example:

err := cloud.ListAuthorizations(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	[]string{"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2"},
)

For more information, see the ListAuthorizations method docs.

func (*AppClient) ListFragments added in v0.53.0

func (c *AppClient) ListFragments(
	ctx context.Context, orgID string, showPublic bool, fragmentVisibility []FragmentVisibility,
) ([]*Fragment, error)

ListFragments gets a list of fragments.

ListFragments example:

fragments, err := cloud.ListFragments(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	true,
	[]app.FragmentVisibility{app.FragmentVisibilityPublic},
)

For more information, see the ListFragments method docs.

func (*AppClient) ListKeys added in v0.53.0

func (c *AppClient) ListKeys(ctx context.Context, orgID string) ([]*APIKeyWithAuthorizations, error)

ListKeys example:

keys, err := cloud.ListKeys(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the [ListKeys method docs].

[ListKeys method docs]: https://docs.viam.com/dev/reference/apis/fleet/#listkeys ListKeys lists all the keys for the organization.

func (*AppClient) ListLocations added in v0.53.0

func (c *AppClient) ListLocations(ctx context.Context, orgID string) ([]*Location, error)

ListLocations gets a list of locations under the specified organization.

ListLocations example:

locations, err := cloud.ListLocations(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the ListLocations method docs.

func (*AppClient) ListMachineFragments added in v0.53.0

func (c *AppClient) ListMachineFragments(ctx context.Context, machineID string, additionalIDs []string) ([]*Fragment, error)

ListMachineFragments gets top level and nested fragments for a machine, as well as any other fragments specified by IDs. Additional fragments are useful to view fragments that will be provisionally added to the machine alongside existing fragments.

ListMachineFragments example:

fragments, err := cloud.ListMachineFragments(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12", []string{})

For more information, see the ListMachineFragments method docs.

func (*AppClient) ListMachineSummaries added in v0.110.0

func (c *AppClient) ListMachineSummaries(
	ctx context.Context,
	organizationID string,
	fragmentIDs, locationIDs []string,
	limit int32,
) ([]*LocationSummary, error)

ListMachineSummaries lists machine summaries, optionally limited, under an organization, organized by provided location ID's.

ListMachineSummaries example:

 summaries, err := cloud.ListMachineSummaries(
		context.Background(),
	   	"a1bcdefghi2jklmnopqrstuvw3xyzabc",
	   	[]string{locationID},
	   	[]string{fragmetnID},
	  	0,
 )

For more information, see the ListMachineSummaries method docs.

func (*AppClient) ListModules added in v0.53.0

func (c *AppClient) ListModules(ctx context.Context, opts *ListModulesOptions) ([]*Module, error)

ListModules lists the modules in the organization.

ListModules example:

orgID := "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2"
modules, err := cloud.ListModules(context.Background(), &app.ListModulesOptions{OrgID: &orgID})

For more information, see the ListModules method docs.

func (*AppClient) ListOAuthApps added in v0.58.0

func (c *AppClient) ListOAuthApps(ctx context.Context, orgID string) ([]string, error)

ListOAuthApps gets the client's list of OAuth applications.

ListOAuthApps example:

apps, err := cloud.ListOAuthApps(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
)

For more information, see the ListOAuthApps method docs.

func (*AppClient) ListOrganizationMembers added in v0.53.0

func (c *AppClient) ListOrganizationMembers(ctx context.Context, orgID string) ([]*OrganizationMember, []*OrganizationInvite, error)

ListOrganizationMembers lists all members of an organization and all invited members to the organization.

ListOrganizationMembers example:

members, invites, err := cloud.ListOrganizationMembers(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the ListOrganizationMembers method docs.

func (*AppClient) ListOrganizations added in v0.53.0

func (c *AppClient) ListOrganizations(ctx context.Context) ([]*Organization, error)

ListOrganizations lists all the organizations.

ListOrganizations example:

organizations, err := cloud.ListOrganizations(context.Background())

For more information, see the ListOrganizations method docs.

func (*AppClient) ListOrganizationsByUser added in v0.53.0

func (c *AppClient) ListOrganizationsByUser(ctx context.Context, userID string) ([]*OrgDetails, error)

ListOrganizationsByUser lists all the organizations that a user belongs to.

ListOrganizationsByUser example:

organizations, err := cloud.ListOrganizationsByUser(context.Background(), "1234a56b-1234-1a23-1234-a12bcd3ef4a5")

For more information, see the ListOrganizationsByUser method docs.

func (*AppClient) ListRegistryItems added in v0.53.0

func (c *AppClient) ListRegistryItems(
	ctx context.Context,
	orgID *string,
	types []PackageType,
	visibilities []Visibility,
	platforms []string,
	statuses []RegistryItemStatus,
	opts *ListRegistryItemsOptions,
) ([]*RegistryItem, error)

ListRegistryItems lists the registry items in an organization.

ListRegistryItems example:

organizationID := "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2"
searchTerm := ""
pageToken := ""
namespaces := []string{}
items, err := cloud.ListRegistryItems(
	context.Background(),
	&organizationID,
	[]app.PackageType{app.PackageTypeModule},
	[]app.Visibility{app.VisibilityPublic},
	[]string{"linux/any"},
	[]app.RegistryItemStatus{app.RegistryItemStatusPublished},
	&app.ListRegistryItemsOptions{
		SearchTerm: &searchTerm,
		PageToken: &pageToken,
		PublicNamespaces: namespaces,
	},
)

For more information, see the ListRegistryItems method docs.

func (*AppClient) ListRobots added in v0.53.0

func (c *AppClient) ListRobots(ctx context.Context, locationID string) ([]*Robot, error)

ListRobots gets a list of robots under a location.

ListRobots example:

robots, err := cloud.ListRobots(context.Background(), "ab1c2d3e45")

For more information, see the ListRobots method docs.

func (*AppClient) LocationAuth added in v0.53.0

func (c *AppClient) LocationAuth(ctx context.Context, locationID string) (*LocationAuth, error)

LocationAuth gets a location's authorization secrets.

LocationAuth example:

auth, err := cloud.LocationAuth(context.Background(), "ab1c2d3e45")

For more information, see the LocationAuth method docs.

func (*AppClient) MarkPartAsMain added in v0.53.0

func (c *AppClient) MarkPartAsMain(ctx context.Context, partID string) error

MarkPartAsMain marks the given part as the main part, and all the others as not.

MarkPartAsMain example:

err := cloud.MarkPartAsMain(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the MarkPartAsMain method docs.

func (*AppClient) MarkPartForRestart added in v0.53.0

func (c *AppClient) MarkPartForRestart(ctx context.Context, partID string) error

MarkPartForRestart marks the given part for restart. Once the robot part checks-in with the app the flag is reset on the robot part. Calling this multiple times before a robot part checks-in has no effect.

MarkPartForRestart example:

err := cloud.MarkPartForRestart(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")

For more information, see the MarkPartForRestart method docs.

func (*AppClient) NewRobot added in v0.53.0

func (c *AppClient) NewRobot(ctx context.Context, name, location string) (string, error)

NewRobot creates a new robot and returns its ID.

NewRobot example:

robotID, err := cloud.NewRobot(context.Background(), "robot_name", "ab1c2d3e45")

For more information, see the NewRobot method docs.

func (*AppClient) NewRobotPart added in v0.53.0

func (c *AppClient) NewRobotPart(ctx context.Context, robotID, partName string) (string, error)

NewRobotPart creates a new robot part and returns its ID.

NewRobotPart example:

partID, err := cloud.NewRobotPart(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12",
	"part_name")

For more information, see the NewRobotPart method docs.

func (c *AppClient) OrganizationGetLogo(ctx context.Context, orgID string) (string, error)

OrganizationGetLogo gets an organization's logo.

OrganizationGetLogo example:

logoURL, err := cloud.OrganizationGetLogo(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
)

For more information, see the OrganizationGetLogo method docs.

func (*AppClient) OrganizationGetSupportEmail added in v0.53.0

func (c *AppClient) OrganizationGetSupportEmail(ctx context.Context, orgID string) (string, error)

OrganizationGetSupportEmail gets an organization's support email.

OrganizationGetSupportEmail example:

email, err := cloud.OrganizationGetSupportEmail(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the OrganizationGetSupportEmail method docs.

func (c *AppClient) OrganizationSetLogo(ctx context.Context, orgID string, logo []byte) error

OrganizationSetLogo sets an organization's logo.

OrganizationSetLogo example:

logoData, err := os.ReadFile("logo.png")
err := cloud.OrganizationSetLogo(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	logoData)
)

For more information, see the OrganizationSetLogo method docs.

func (*AppClient) OrganizationSetSupportEmail added in v0.53.0

func (c *AppClient) OrganizationSetSupportEmail(ctx context.Context, orgID, email string) error

OrganizationSetSupportEmail sets an organization's support email.

OrganizationSetSupportEmail example:

err := cloud.OrganizationSetSupportEmail(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2", "test@example.com")

For more information, see the OrganizationSetSupportEmail method docs.

func (*AppClient) RemoveRole added in v0.53.0

func (c *AppClient) RemoveRole(ctx context.Context, authorization *Authorization) error

RemoveRole deletes an identity authorization.

func (*AppClient) RenameKey added in v0.53.0

func (c *AppClient) RenameKey(ctx context.Context, id, name string) (string, string, error)

RenameKey renames an API key and returns its ID and name.

RenameKey example:

_, name, err := cloud.RenameKey(context.Background(), "a1bcdefghi2jklmnopqrstuvw3xyzabc", "new_name")

For more information, see the RenameKey method docs.

func (*AppClient) ResendOrganizationInvite added in v0.53.0

func (c *AppClient) ResendOrganizationInvite(ctx context.Context, orgID, email string) (*OrganizationInvite, error)

ResendOrganizationInvite resends an organization invite.

ResendOrganizationInvite example:

invite, err := cloud.ResendOrganizationInvite(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2", "test@example.com")

For more information, see the ResendOrganizationInvite method docs.

func (*AppClient) RotateKey added in v0.53.0

func (c *AppClient) RotateKey(ctx context.Context, id string) (string, string, error)

RotateKey rotates an API key and returns its ID and key.

RotateKey example:

id, key, err := cloud.RotateKey(context.Background(), "a1bcdefghi2jklmnopqrstuvw3xyzabc")

For more information, see the RotateKey method docs.

func (*AppClient) ShareLocation added in v0.53.0

func (c *AppClient) ShareLocation(ctx context.Context, locationID, orgID string) error

ShareLocation shares a location with an organization.

ShareLocation example:

err := cloud.ShareLocation(context.Background(), "ab1c2d3e45", "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the ShareLocation method docs.

func (*AppClient) TailRobotPartLogs added in v0.53.0

func (c *AppClient) TailRobotPartLogs(
	ctx context.Context, id string, errorsOnly bool, opts *TailRobotPartLogsOptions,
) (*RobotPartLogStream, error)

TailRobotPartLogs gets a stream of log entries for a specific robot part. Logs are ordered by newest first.

TailRobotPartLogs example:

logFilter := "error"
stream, err := cloud.TailRobotPartLogs(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12",
	true,
	&app.TailRobotPartLogsOptions{
		Filter: &logFilter,
	},
)

For more information, see the TailRobotPartLogs method docs.

func (*AppClient) TransferRegistryItem added in v0.53.0

func (c *AppClient) TransferRegistryItem(ctx context.Context, itemID, newPublicNamespace string) error

TransferRegistryItem transfers a registry item to a namespace.

TransferRegistryItem example:

err := cloud.TransferRegistryItem(context.Background(), "namespace:name", "new_namespace")

For more information, see the TransferRegistryItem method docs.

func (*AppClient) UnshareLocation added in v0.53.0

func (c *AppClient) UnshareLocation(ctx context.Context, locationID, orgID string) error

UnshareLocation stops sharing a location with an organization.

UnshareLocation example:

err := cloud.UnshareLocation(context.Background(), "ab1c2d3e45", "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")

For more information, see the UnshareLocation method docs.

func (*AppClient) UpdateBillingService added in v0.53.0

func (c *AppClient) UpdateBillingService(ctx context.Context, orgID string, billingAddress *BillingAddress) error

UpdateBillingService updates the billing service of an organization.

func (*AppClient) UpdateFragment added in v0.53.0

func (c *AppClient) UpdateFragment(
	ctx context.Context, id, name string, config map[string]interface{}, opts *UpdateFragmentOptions,
) (*Fragment, error)

UpdateFragment updates a fragment.

UpdateFragment example:

fragmentConfig := map[string]interface{}{
	"components": []map[string]interface{}{
		{
			"name":       "camera-1",
			"api":        "rdk:component:camera",
			"model":      "rdk:builtin:fake",
			"attributes": map[string]interface{}{},
		},
	},
}

fragment, err := cloud.UpdateFragment(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"My Fragment",
	fragmentConfig,
	&app.UpdateFragmentOptions{Visibility: &app.FragmentVisibilityPublic})

For more information, see the UpdateFragment method docs.

func (*AppClient) UpdateLocation added in v0.53.0

func (c *AppClient) UpdateLocation(ctx context.Context, locationID string, opts *UpdateLocationOptions) (*Location, error)

UpdateLocation updates a location.

UpdateLocation example:

 locationID := "ab1c2d3e45"
 name := "test-name"
	err := cloud.UpdateLocation(
		context.Background(),
		"ab1c2d3e45",
		&app.UpdateLocationOptions{
			Name: &name,
			ParentLocationID: &locationID,
		})

For more information, see the UpdateLocation method docs.

func (*AppClient) UpdateLocationMetadata added in v0.67.0

func (c *AppClient) UpdateLocationMetadata(ctx context.Context, locationID string, data interface{}) error

UpdateLocationMetadata updates the user-defined metadata for a location.

UpdateLocationMetadata example:

err := cloud.UpdateLocationMetadata(
	context.Background(),
	"ab1c2d3e45",
	map[string]interface{}{
		"key": "value",
	},
)

For more information, see the UpdateLocationMetadata method docs.

func (*AppClient) UpdateModule added in v0.53.0

func (c *AppClient) UpdateModule(
	ctx context.Context,
	moduleID string,
	visibility Visibility,
	url,
	description string,
	models []*Model,
	apps []*App,
	entrypoint string,
	opts *UpdateModuleOptions,
) (string, error)

UpdateModule updates the documentation URL, description, models, entrypoint, and/or the visibility of a module and returns its URL. A path to a setup script can be added that is run before a newly downloaded module starts.

UpdateModule example:

model := &app.Model{
	API:   "rdk:service:generic",
	Model: "docs-test:new_test_module:test_model",
}
app := &app.App{
	Name:       "app_name",
	Type:       "app_type",
	Entrypoint: "entrypoint",
}
firstRun := "first_run.sh"
url, err := cloud.UpdateModule(
	context.Background(),
	"namespace:name",
	app.VisibilityPublic,
	"https://example.com",
	"description",
	[]*app.Model{model},
	[]*app.App{app},
	"entrypoint",
	&app.UpdateModuleOptions{FirstRun: &firstRun},
)

For more information, see the UpdateModule method docs.

func (*AppClient) UpdateOrganization added in v0.53.0

func (c *AppClient) UpdateOrganization(ctx context.Context, orgID string, opts *UpdateOrganizationOptions) (*Organization, error)

UpdateOrganization updates an organization.

UpdateOrganization example:

 name := "tests-name"
	organization, err := cloud.UpdateOrganization(
		context.Background(),
		"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
		&UpdateOrganizationOptions{
			Name: &name,
		})

For more information, see the UpdateOrganization method docs.

func (*AppClient) UpdateOrganizationInviteAuthorizations added in v0.53.0

func (c *AppClient) UpdateOrganizationInviteAuthorizations(
	ctx context.Context, orgID, email string, addAuthorizations, removeAuthorizations []*Authorization,
) (*OrganizationInvite, error)

UpdateOrganizationInviteAuthorizations updates the authorizations attached to an organization invite.

UpdateOrganizationInviteAuthorizations example:

invite, err := cloud.UpdateOrganizationInviteAuthorizations(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	"test@example.com",
	[]*app.Authorization{
		AuthorizationType: "role",
		AuthorizationID:   "location_owner",
		ResourceType:      "location",
		ResourceID:        LOCATION_ID,
		OrganizationID:    ORG_ID,
		IdentityID:        "",
	},
	[]*app.Authorization{})

For more information, see the UpdateOrganizationInviteAuthorizations method docs.

func (*AppClient) UpdateOrganizationMetadata added in v0.67.0

func (c *AppClient) UpdateOrganizationMetadata(ctx context.Context, organizationID string, data interface{}) error

UpdateOrganizationMetadata updates the user-defined metadata for an organization.

UpdateOrganizationMetadata example:

err := cloud.UpdateOrganizationMetadata(
	context.Background(),
	"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
	map[string]interface{}{
		"key": "value",
	},
)

For more information, see the UpdateOrganizationMetadata method docs.

func (*AppClient) UpdateRegistryItem added in v0.53.0

func (c *AppClient) UpdateRegistryItem(
	ctx context.Context, itemID string, packageType PackageType, description string, visibility Visibility, opts *UpdateRegistryItemOptions,
) error

UpdateRegistryItem updates a registry item.

UpdateRegistryItem example:

siteURL := "https://example.com"
err := cloud.UpdateRegistryItem(
	context.Background(),
	"namespace:name",
	app.PackageTypeMLModel,
	"description",
	app.VisibilityPrivate,
	&app.UpdateRegistryItemOptions{URL: &siteURL},
)

For more information, see the UpdateRegistryItem method docs.

func (*AppClient) UpdateRobot added in v0.53.0

func (c *AppClient) UpdateRobot(ctx context.Context, id, name, location string) (*Robot, error)

UpdateRobot updates a robot.

UpdateRobot example:

robot, err := cloud.UpdateRobot(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12", "robot_name", "ab1c2d3e45")

For more information, see the UpdateRobot method docs.

func (*AppClient) UpdateRobotMetadata added in v0.67.0

func (c *AppClient) UpdateRobotMetadata(ctx context.Context, robotID string, data interface{}) error

UpdateRobotMetadata updates the user-defined metadata for a robot.

UpdateRobotMetadata example:

err := cloud.UpdateRobotMetadata(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12",
	map[string]interface{}{
		"key": "value",
	},
)

For more information, see the UpdateRobotMetadata method docs.

func (*AppClient) UpdateRobotPart added in v0.53.0

func (c *AppClient) UpdateRobotPart(ctx context.Context, id, name string, robotConfig interface{}) (*RobotPart, error)

UpdateRobotPart updates a robot part.

UpdateRobotPart example:

robotConfig := map[string]interface{}{
	"components": []map[string]interface{}{
		{
			"name":       "camera-1",
			"api":        "rdk:component:camera",
			"model":      "rdk:builtin:fake",
			"attributes": map[string]interface{}{},
		},
	},
}

part, err := cloud.UpdateRobotPart(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12",
	"part_name",
	map[string]interface{}{
		"key": "value",
	},
)

For more information, see the UpdateRobotPart method docs.

func (*AppClient) UpdateRobotPartMetadata added in v0.67.0

func (c *AppClient) UpdateRobotPartMetadata(ctx context.Context, robotID string, data interface{}) error

UpdateRobotPartMetadata updates the user-defined metadata for a robot part.

UpdateRobotPartMetadata example:

err := cloud.UpdateRobotPartMetadata(
	context.Background(),
	"1ab2345c-a123-1ab2-1abc-1ab234567a12",
	map[string]interface{}{
		"key": "value",
	},
)

For more information, see the UpdateRobotPartMetadata method docs.

func (*AppClient) UploadModuleFile added in v0.53.0

func (c *AppClient) UploadModuleFile(ctx context.Context, fileInfo ModuleFileInfo, file []byte) (string, error)

UploadModuleFile uploads a module file and returns the URL of the uploaded file.

UploadModuleFile example:

moduleFileInfo := app.ModuleFileInfo{
	ModuleID: "namespace:name",
	Version:  "1.0.0",
	Platform: "darwin/arm64",
}
fileURL, err := cloud.UploadModuleFile(context.Background(), fileInfo, []byte("empty.txt"))

For more information, see the UploadModuleFile method docs.

type AppContent added in v0.110.0

type AppContent struct {
	BlobPath   string
	Entrypoint string
	AppType    int
	Public     bool
}

AppContent defines where how to retrieve a Viam Apps app from GCS.

type AuthResourceType added in v0.53.0

type AuthResourceType string

AuthResourceType represents the valid authorization resource type for an Authorization.

type AuthRole added in v0.53.0

type AuthRole string

AuthRole represents the valid authorizaiton types for an Authorization.

const (
	// AuthRoleOwner represents an owner authorization type.
	AuthRoleOwner AuthRole = "owner"
	// AuthRoleOperator represents an operator authorization type.
	AuthRoleOperator AuthRole = "operator"
)

type AuthenticationType added in v0.53.0

type AuthenticationType int

AuthenticationType specifies the type of authentication.

const (
	// AuthenticationTypeUnspecified represents an unspecified authentication.
	AuthenticationTypeUnspecified AuthenticationType = iota
	// AuthenticationTypeWebOAuth represents authentication using Web OAuth.
	AuthenticationTypeWebOAuth
	// AuthenticationTypeAPIKey represents authentication using an API key.
	AuthenticationTypeAPIKey
	// AuthenticationTypeRobotPartSecret represents authentication using a robot part secret.
	AuthenticationTypeRobotPartSecret
	// AuthenticationTypeLocationSecret represents authentication using a location secret.
	AuthenticationTypeLocationSecret
)

type AuthenticatorInfo added in v0.53.0

type AuthenticatorInfo struct {
	Type          AuthenticationType
	Value         string
	IsDeactivated bool
}

AuthenticatorInfo holds the information of an authenticator.

type Authorization added in v0.53.0

type Authorization struct {
	AuthorizationType AuthRole
	AuthorizationID   string
	ResourceType      AuthResourceType
	ResourceID        string
	IdentityID        string
	OrganizationID    string
	IdentityType      string
}

Authorization has the information about a specific authorization.

type AuthorizationDetails added in v0.53.0

type AuthorizationDetails struct {
	AuthorizationType string
	AuthorizationID   string
	ResourceType      string
	ResourceID        string
	OrgID             string
}

AuthorizationDetails has the details for an authorization.

type AuthorizedPermissions added in v0.53.0

type AuthorizedPermissions struct {
	ResourceType string
	ResourceID   string
	Permissions  []string
}

AuthorizedPermissions is authorized permissions.

type BillingAddress added in v0.53.0

type BillingAddress struct {
	AddressLine1 string
	AddressLine2 *string
	City         string
	State        string
	Zipcode      string
}

BillingAddress contains billing address details.

type BillingClient added in v0.53.0

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

BillingClient is a gRPC client for method calls to the Billing API.

func (*BillingClient) GetCurrentMonthUsage added in v0.53.0

func (c *BillingClient) GetCurrentMonthUsage(ctx context.Context, orgID string) (*GetCurrentMonthUsageResponse, error)

GetCurrentMonthUsage gets the data usage information for the current month for an organization.

func (*BillingClient) GetInvoicePDF added in v0.53.0

func (c *BillingClient) GetInvoicePDF(ctx context.Context, id, orgID string) ([]byte, error)

GetInvoicePDF returns raw byte slices representing the invoice PDF data.

func (*BillingClient) GetInvoicesSummary added in v0.53.0

func (c *BillingClient) GetInvoicesSummary(ctx context.Context, orgID string) (float64, []*InvoiceSummary, error)

GetInvoicesSummary returns the outstanding balance and the invoice summaries of an organization.

func (*BillingClient) GetOrgBillingInformation added in v0.53.0

func (c *BillingClient) GetOrgBillingInformation(ctx context.Context, orgID string) (*GetOrgBillingInformationResponse, error)

GetOrgBillingInformation gets the billing information of an organization.

func (*BillingClient) SendPaymentRequiredEmail added in v0.53.0

func (c *BillingClient) SendPaymentRequiredEmail(ctx context.Context, customerOrgID, billingOwnerOrgID string) error

SendPaymentRequiredEmail sends an email about payment requirement.

type BinaryData added in v0.52.0

type BinaryData struct {
	Binary   []byte
	Metadata *BinaryMetadata
}

BinaryData contains data and metadata associated with binary data.

type BinaryDataByFilterResponse added in v0.55.0

type BinaryDataByFilterResponse struct {
	BinaryData []*BinaryData
	Count      int
	Last       string
}

BinaryDataByFilterResponse represents the result of a BinaryDataByFilter query. It contains the retrieved binary data and associated metadata, the total number of entries retrieved (Count), and the ID of the last returned page (Last).

type BinaryDataByIDsOptions added in v0.106.0

type BinaryDataByIDsOptions struct {
	// IncludeBinary controls whether binary data is included in the response.
	IncludeBinary bool
}

BinaryDataByIDsOptions contains optional parameters for BinaryDataByIDs.

type BinaryDataCaptureUploadOptions added in v0.54.0

type BinaryDataCaptureUploadOptions struct {
	Type             *DataType
	FileName         *string
	MethodParameters map[string]interface{}
	Tags             []string
	DatasetIDs       []string
	DataRequestTimes *[2]time.Time
}

BinaryDataCaptureUploadOptions represents optional parameters for the BinaryDataCaptureUpload method.

type BinaryID added in v0.52.0

type BinaryID struct {
	FileID         string
	OrganizationID string
	LocationID     string
}

BinaryID is the unique identifier for a file that one can request to be retrieved or modified.

type BinaryMetadata added in v0.52.0

type BinaryMetadata struct {
	ID              string
	BinaryDataID    string
	CaptureMetadata CaptureMetadata
	TimeRequested   time.Time
	TimeReceived    time.Time
	FileName        string
	FileExt         string
	URI             string
	Annotations     *Annotations
	DatasetIDs      []string
}

BinaryMetadata is the metadata associated with binary data.

type BoundingBox added in v0.52.0

type BoundingBox struct {
	ID             string
	Label          string
	XMinNormalized float64
	YMinNormalized float64
	XMaxNormalized float64
	YMaxNormalized float64
}

BoundingBox represents a labeled bounding box on an image. x and y values are normalized ratios between 0 and 1.

type CaptureInterval added in v0.52.0

type CaptureInterval struct {
	Start time.Time
	End   time.Time
}

CaptureInterval describes the start and end time of the capture in this file.

type CaptureMetadata added in v0.52.0

type CaptureMetadata struct {
	OrganizationID   string
	LocationID       string
	RobotName        string
	RobotID          string
	PartName         string
	PartID           string
	ComponentType    string
	ComponentName    string
	MethodName       string
	MethodParameters map[string]interface{}
	Tags             []string
	MimeType         string
}

CaptureMetadata contains information on the settings used for the data capture.

type Classification added in v0.93.0

type Classification struct {
	ID    string
	Label string
}

Classification represents a labeled classification on an image.

type CloudConfig added in v0.53.0

type CloudConfig struct {
	ID         string
	Secret     string
	AppAddress string
	APIKey     *APIKey
}

CloudConfig is the minimal config to create a /etc/viam.json, containing the smart machine's part ID and secret.

type CreateDataPipelineOptions added in v0.81.0

type CreateDataPipelineOptions struct {
	TabularDataSourceType TabularDataSourceType
}

CreateDataPipelineOptions contains optional parameters for CreateDataPipeline.

type CreateFragmentOptions added in v0.53.0

type CreateFragmentOptions struct {
	Visibility *FragmentVisibility
}

CreateFragmentOptions contains optional parameters for CreateFragment.

type CreateLocationOptions added in v0.53.0

type CreateLocationOptions struct {
	// ParentLocationID is the parent location to move the location under.
	ParentLocationID *string
}

CreateLocationOptions contains optional parameters for CreateLocation.

type CreateOrganizationInviteOptions added in v0.53.0

type CreateOrganizationInviteOptions struct {
	// SendEmailInvite defaults to true to send an email to the receipient of the invite.
	// The user must accept the email to be added to the associated authorizations.
	// If false, the user receives the associated authorization on the next login of the user with the associated email address.
	SendEmailInvite *bool
}

CreateOrganizationInviteOptions contains optional parameters for CreateOrganizationInvite.

type DataByFilterOptions added in v0.54.0

type DataByFilterOptions struct {
	// No Filter implies all data.
	Filter *Filter
	// Limit is the maximum number of entries to include in a page. Limit defaults to 50 if unspecified.
	Limit int
	// Last indicates the object identifier of the Last-returned data.
	// This is returned by calls to TabularDataByFilter and BinaryDataByFilter as the `Last` value.
	// If provided, the server will return the next data entries after the last object identifier.
	Last                string
	SortOrder           Order
	CountOnly           bool
	IncludeInternalData bool
}

DataByFilterOptions contains optional parameters for TabularDataByFilter and BinaryDataByFilter.

type DataClient added in v0.52.0

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

DataClient implements the DataServiceClient interface.

func (*DataClient) AddBinaryDataToDatasetByIDs added in v0.52.0

func (d *DataClient) AddBinaryDataToDatasetByIDs(
	ctx context.Context,
	binaryDataIDs []string,
	datasetID string,
) error

AddBinaryDataToDatasetByIDs adds the binary data with the given binary IDs to the dataset.

func (*DataClient) AddBoundingBoxToImageByID added in v0.52.0

func (d *DataClient) AddBoundingBoxToImageByID(
	ctx context.Context,
	binaryDataID string,
	label string,
	xMinNormalized float64,
	yMinNormalized float64,
	xMaxNormalized float64,
	yMaxNormalized float64,
) (string, error)

AddBoundingBoxToImageByID adds a bounding box to an image with the specified ID, using the provided label and position in normalized coordinates. All normalized coordinates (xMin, yMin, xMax, yMax) must be float values in the range [0, 1].

func (*DataClient) AddTagsToBinaryDataByFilter added in v0.52.0

func (d *DataClient) AddTagsToBinaryDataByFilter(ctx context.Context, tags []string, filter *Filter) error

AddTagsToBinaryDataByFilter adds string tags, unless the tags are already present, to binary data based on the given filter. If no filter is given, all data will be tagged.

func (*DataClient) AddTagsToBinaryDataByIDs added in v0.52.0

func (d *DataClient) AddTagsToBinaryDataByIDs(ctx context.Context, tags, binaryDataIDs []string) error

AddTagsToBinaryDataByIDs adds string tags, unless the tags are already present, to binary data based on given IDs.

func (*DataClient) BinaryDataByFilter added in v0.52.0

func (d *DataClient) BinaryDataByFilter(
	ctx context.Context, includeBinary bool, opts *DataByFilterOptions,
) (*BinaryDataByFilterResponse, error)

BinaryDataByFilter queries binary data and metadata based on given filters.

func (*DataClient) BinaryDataByIDs added in v0.52.0

func (d *DataClient) BinaryDataByIDs(ctx context.Context, binaryDataIDs []string, opts ...*BinaryDataByIDsOptions) ([]*BinaryData, error)

BinaryDataByIDs queries binary data and metadata based on given IDs. opts is optional; if not provided, IncludeBinary defaults to true for backward compatibility.

func (*DataClient) BinaryDataCaptureUpload added in v0.52.0

func (d *DataClient) BinaryDataCaptureUpload(
	ctx context.Context,
	binaryData []byte,
	partID string,
	componentType string,
	componentName string,
	methodName string,
	fileExtension string,
	options *BinaryDataCaptureUploadOptions,
) (string, error)

BinaryDataCaptureUpload uploads the contents and metadata for binary data.

func (*DataClient) BoundingBoxLabelsByFilter added in v0.52.0

func (d *DataClient) BoundingBoxLabelsByFilter(ctx context.Context, filter *Filter) ([]string, error)

BoundingBoxLabelsByFilter retrieves all unique string labels for bounding boxes that match the specified filter. It returns a list of these labels. If no filter is given, all labels are returned.

func (*DataClient) ConfigureDatabaseUser added in v0.52.0

func (d *DataClient) ConfigureDatabaseUser(
	ctx context.Context,
	organizationID string,
	password string,
) error

ConfigureDatabaseUser configures a database user for the Viam organization's MongoDB Atlas Data Federation instance.

func (*DataClient) CreateBinaryDataSignedURL added in v0.104.0

func (d *DataClient) CreateBinaryDataSignedURL(ctx context.Context, binaryDataID string, expirationMinutes uint32) (string, error)

CreateBinaryDataSignedURL creates a signed URL for a given binary data ID. The signed URL can be used for public access to the binary data for a limited time.

func (*DataClient) CreateDataPipeline added in v0.73.0

func (d *DataClient) CreateDataPipeline(
	ctx context.Context, organizationID, name string, query []map[string]interface{}, schedule string,
	enableBackfill bool, opts *CreateDataPipelineOptions,
) (string, error)

CreateDataPipeline creates a new data pipeline using the given query and schedule.

func (*DataClient) CreateDataset added in v0.53.0

func (d *DataClient) CreateDataset(ctx context.Context, name, organizationID string) (string, error)

CreateDataset makes a new dataset.

func (*DataClient) DeleteBinaryDataByFilter added in v0.52.0

func (d *DataClient) DeleteBinaryDataByFilter(ctx context.Context, filter *Filter) (int, error)

DeleteBinaryDataByFilter deletes binary data based on given filters. If filter is empty, delete all data. It returns the number of binary datapoints deleted.

func (*DataClient) DeleteBinaryDataByIDs added in v0.52.0

func (d *DataClient) DeleteBinaryDataByIDs(ctx context.Context, binaryDataIDs []string) (int, error)

DeleteBinaryDataByIDs deletes binary data based on given IDs. It returns the number of binary datapoints deleted.

func (*DataClient) DeleteDataPipeline added in v0.73.0

func (d *DataClient) DeleteDataPipeline(ctx context.Context, id string) error

DeleteDataPipeline deletes a data pipeline by its ID.

func (*DataClient) DeleteDataset added in v0.53.0

func (d *DataClient) DeleteDataset(ctx context.Context, id string) error

DeleteDataset deletes an existing dataset.

func (*DataClient) DeleteTabularData added in v0.52.0

func (d *DataClient) DeleteTabularData(
	ctx context.Context, organizationID string, deleteOlderThanDays int, filter *pb.DeleteTabularFilter,
) (int, error)

DeleteTabularData deletes tabular data older than a specified number of days. Delete data that was captured more than deleteOlderThanDays ago. For example, a value of 10 deletes any data that was captured more than 10 days ago. A value of 0 deletes all existing data. Optionally, a filter can be provided to further constrain which data is deleted. If provided, only data matching the filter will be deleted. If omitted, data is deleted based on organizationID and deleteOlderThanDays. Returns the number of tabular datapoints deleted.

func (*DataClient) DisableDataPipeline added in v0.73.0

func (d *DataClient) DisableDataPipeline(ctx context.Context, id string) error

DisableDataPipeline disables a data pipeline by its ID.

func (*DataClient) EnableDataPipeline added in v0.73.0

func (d *DataClient) EnableDataPipeline(ctx context.Context, id string) error

EnableDataPipeline enables a data pipeline by its ID.

func (*DataClient) ExportTabularData added in v0.56.0

func (d *DataClient) ExportTabularData(
	ctx context.Context, partID, resourceName, resourceSubtype, method string, interval CaptureInterval, opts *TabularDataOptions,
) ([]*ExportTabularDataResponse, error)

ExportTabularData returns a stream of ExportTabularDataResponses.

func (*DataClient) FileUploadFromBytes added in v0.52.0

func (d *DataClient) FileUploadFromBytes(
	ctx context.Context,
	partID string,
	data []byte,
	opts *FileUploadOptions,
) (string, error)

FileUploadFromBytes uploads the contents and metadata for binary data such as encoded images or other data represented by bytes and returns the file id of the uploaded data.

func (*DataClient) FileUploadFromPath added in v0.52.0

func (d *DataClient) FileUploadFromPath(
	ctx context.Context,
	partID string,
	filePath string,
	opts *FileUploadOptions,
) (string, error)

FileUploadFromPath uploads the contents and metadata for binary data created from a filepath and returns the file id of the uploaded data.

func (*DataClient) GetDataPipeline added in v0.73.0

func (d *DataClient) GetDataPipeline(ctx context.Context, id string) (*DataPipeline, error)

GetDataPipeline gets a data pipeline configuration by its ID.

func (*DataClient) GetDatabaseConnection added in v0.52.0

func (d *DataClient) GetDatabaseConnection(ctx context.Context, organizationID string) (*GetDatabaseConnectionResponse, error)

GetDatabaseConnection establishes a connection to a MongoDB Atlas Data Federation instance. It returns the hostname endpoint, a URI for connecting to the database via MongoDB clients, and a flag indicating whether a database user is configured for the Viam organization.

func (*DataClient) GetLatestTabularData added in v0.54.0

func (d *DataClient) GetLatestTabularData(
	ctx context.Context, partID, resourceName, resourceSubtype, methodName string, opts *TabularDataOptions) (
	*GetLatestTabularDataResponse, error,
)

GetLatestTabularData gets the most recent tabular data captured from the specified data source, as well as the time that it was captured and synced. If no data was synced to the data source within the last year, LatestTabularDataReturn will be empty.

func (*DataClient) ListDataPipelineRuns added in v0.73.0

func (d *DataClient) ListDataPipelineRuns(ctx context.Context, id string, pageSize uint32) (*ListDataPipelineRunsPage, error)

ListDataPipelineRuns lists all of the data pipeline runs for a data pipeline.

func (*DataClient) ListDataPipelines added in v0.73.0

func (d *DataClient) ListDataPipelines(ctx context.Context, organizationID string) ([]*DataPipeline, error)

ListDataPipelines lists all of the data pipelines for an organization.

func (*DataClient) ListDatasetsByIDs added in v0.53.0

func (d *DataClient) ListDatasetsByIDs(ctx context.Context, ids []string) ([]*Dataset, error)

ListDatasetsByIDs lists all of the datasets specified by the given dataset IDs.

func (*DataClient) ListDatasetsByOrganizationID added in v0.53.0

func (d *DataClient) ListDatasetsByOrganizationID(ctx context.Context, organizationID string) ([]*Dataset, error)

ListDatasetsByOrganizationID lists all of the datasets for an organization.

func (*DataClient) RemoveBinaryDataFromDatasetByIDs added in v0.52.0

func (d *DataClient) RemoveBinaryDataFromDatasetByIDs(
	ctx context.Context,
	binaryDataIDs []string,
	datasetID string,
) error

RemoveBinaryDataFromDatasetByIDs removes the binary data with the given binary IDs from the dataset.

func (*DataClient) RemoveBoundingBoxFromImageByID added in v0.52.0

func (d *DataClient) RemoveBoundingBoxFromImageByID(
	ctx context.Context,
	bboxID string,
	binaryDataID string,
) error

RemoveBoundingBoxFromImageByID removes a bounding box from an image with the given ID.

func (*DataClient) RemoveTagsFromBinaryDataByFilter added in v0.52.0

func (d *DataClient) RemoveTagsFromBinaryDataByFilter(ctx context.Context,
	tags []string, filter *Filter,
) (int, error)

RemoveTagsFromBinaryDataByFilter removes the specified string tags from binary data that match the given filter. If no filter is given, all data will be untagged. It returns the number of binary files from which tags were removed.

func (*DataClient) RemoveTagsFromBinaryDataByIDs added in v0.52.0

func (d *DataClient) RemoveTagsFromBinaryDataByIDs(ctx context.Context,
	tags, binaryDataIDs []string,
) (int, error)

RemoveTagsFromBinaryDataByIDs removes string tags from binary data based on given IDs. It returns the number of binary files which had tags removed.

func (*DataClient) RenameDataPipeline added in v0.88.0

func (d *DataClient) RenameDataPipeline(
	ctx context.Context, id, name string,
) error

RenameDataPipeline updates a data pipeline configuration by its ID.

func (*DataClient) RenameDataset added in v0.53.0

func (d *DataClient) RenameDataset(ctx context.Context, id, name string) error

RenameDataset modifies the name of an existing dataset.

func (*DataClient) StreamingDataCaptureUpload added in v0.52.0

func (d *DataClient) StreamingDataCaptureUpload(
	ctx context.Context,
	data []byte,
	partID string,
	fileExt string,
	options *StreamingDataCaptureUploadOptions,
) (string, error)

StreamingDataCaptureUpload uploads metadata and streaming binary data in chunks.

func (*DataClient) TabularDataByFilter added in v0.52.0

func (d *DataClient) TabularDataByFilter(ctx context.Context, opts *DataByFilterOptions) (*TabularDataByFilterResponse, error)

TabularDataByFilter queries tabular data and metadata based on given filters. Deprecated: This endpoint will be removed in a future version.

func (*DataClient) TabularDataByMQL added in v0.52.0

func (d *DataClient) TabularDataByMQL(
	ctx context.Context, organizationID string, query []map[string]interface{}, opts *TabularDataByMQLOptions,
) ([]map[string]interface{}, error)

TabularDataByMQL queries tabular data with MQL (MongoDB Query Language) queries.

func (*DataClient) TabularDataBySQL added in v0.52.0

func (d *DataClient) TabularDataBySQL(ctx context.Context, organizationID, sqlQuery string) ([]map[string]interface{}, error)

TabularDataBySQL queries tabular data with a SQL query.

func (*DataClient) TabularDataCaptureUpload added in v0.52.0

func (d *DataClient) TabularDataCaptureUpload(
	ctx context.Context,
	tabularData []map[string]interface{},
	partID string,
	componentType string,
	componentName string,
	methodName string,
	dataRequestTimes [][2]time.Time,
	options *TabularDataCaptureUploadOptions,
) (string, error)

TabularDataCaptureUpload uploads the contents and metadata for tabular data.

func (*DataClient) UpdateBoundingBox added in v0.52.0

func (d *DataClient) UpdateBoundingBox(ctx context.Context, binaryDataID, bboxID string, opts *UpdateBoundingBoxOptions) error

UpdateBoundingBox updates the bounding box for a given bbox ID for the file represented by the binary ID.

func (*DataClient) UploadImageToDatasets added in v0.90.0

func (d *DataClient) UploadImageToDatasets(
	ctx context.Context,
	partID string,
	image image.Image,
	datasetIDs, tags []string,
	mimeType MimeType,
	opts *FileUploadOptions,
) (string, error)

UploadImageToDatasets uploads the contents and metadata for an image, adds it to a dataset, and returns the file id of the uploaded data.

type DataPipeline added in v0.73.0

type DataPipeline struct {
	ID             string
	OrganizationID string
	Name           string
	MqlBinary      [][]byte
	Schedule       string
	Enabled        bool
	CreatedOn      time.Time
	UpdatedAt      time.Time
	DataSourceType TabularDataSourceType
}

DataPipeline contains the configuration information of a data pipeline.

type DataPipelineRun added in v0.73.0

type DataPipelineRun struct {
	ID string
	// StartTime is the time the data pipeline run started.
	StartTime time.Time
	// EndTime is the time the data pipeline run completed or failed.
	EndTime time.Time
	// DataStartTime describes the start time of the data that was read by the data pipeline run.
	DataStartTime time.Time
	// DataEndTime describes the end time of the data that was read by the data pipeline run.
	DataEndTime time.Time
	// Status is the run's current status.
	Status DataPipelineRunStatus
	// ErrorMessage is the error message of the data pipeline run. It is only set if the run failed.
	ErrorMessage string
}

DataPipelineRun contains the information of an individual data pipeline execution.

type DataPipelineRunStatus added in v0.73.0

type DataPipelineRunStatus int32

DataPipelineRunStatus is the status of a data pipeline run.

const (
	// DataPipelineRunStatusUnspecified indicates that the data pipeline run is undefined, this should never happen.
	DataPipelineRunStatusUnspecified DataPipelineRunStatus = iota
	// DataPipelineRunStatusScheduled indicates that the data pipeline run has not yet started.
	DataPipelineRunStatusScheduled
	// DataPipelineRunStatusStarted indicates that the data pipeline run is currently running.
	DataPipelineRunStatusStarted
	// DataPipelineRunStatusCompleted indicates that the data pipeline run has completed successfully.
	DataPipelineRunStatusCompleted
	// DataPipelineRunStatusFailed indicates that the data pipeline run has failed.
	DataPipelineRunStatusFailed
)

type DataRequest added in v0.52.0

type DataRequest struct {
	Filter    Filter
	Limit     int
	Last      string
	SortOrder Order
}

type DataType added in v0.52.0

type DataType int32

DataType specifies the type of data uploaded.

const (
	DataTypeUnspecified DataType = iota
	DataTypeBinarySensor
	DataTypeTabularSensor
	DataTypeFile
)

DataType constants define the possible DataType options.

type Dataset added in v0.53.0

type Dataset struct {
	ID             string
	Name           string
	OrganizationID string
	TimeCreated    *time.Time
}

Dataset contains the information of a dataset.

type ExportTabularDataResponse added in v0.56.0

type ExportTabularDataResponse struct {
	OrganizationID   string
	LocationID       string
	RobotID          string
	RobotName        string
	PartID           string
	PartName         string
	ResourceName     string
	ResourceSubtype  string
	MethodName       string
	TimeCaptured     time.Time
	MethodParameters map[string]interface{}
	Tags             []string
	Payload          map[string]interface{}
}

ExportTabularDataResponse represents the result of an ExportTabularData API call.

type FileData added in v0.52.0

type FileData struct {
	Data []byte
}

FileData contains the contents of binary (image + file) data.

type FileUploadOptions added in v0.52.0

type FileUploadOptions struct {
	ComponentType    *string
	ComponentName    *string
	MethodName       *string
	FileName         *string
	MethodParameters map[string]interface{}
	FileExtension    *string
	Tags             []string
	DatasetIDs       []string
}

FileUploadOptions represents optional parameters for the FileUploadFromPath & FileUploadFromBytes methods.

type Filter added in v0.52.0

type Filter struct {
	ComponentName   string
	ComponentType   string
	Method          string
	RobotName       string
	RobotID         string
	PartName        string
	PartID          string
	LocationIDs     []string
	OrganizationIDs []string
	MimeType        []string
	Interval        CaptureInterval
	TagsFilter      TagsFilter
	BboxLabels      []string
	DatasetID       string
}

Filter defines the fields over which we can filter data using a logic AND.

type Fragment added in v0.53.0

type Fragment struct {
	ID                string
	Name              string
	Fragment          map[string]interface{}
	OrganizationOwner string
	Public            bool
	CreatedOn         *time.Time
	OrganizationName  string
	RobotPartCount    int
	OrganizationCount int
	OnlyUsedByOwner   bool
	Visibility        FragmentVisibility
	LastUpdated       *time.Time
}

Fragment stores the information of a fragment.

type FragmentHistoryEntry added in v0.53.0

type FragmentHistoryEntry struct {
	Fragment string
	EditedOn *time.Time
	Old      *Fragment
	EditedBy *AuthenticatorInfo
}

FragmentHistoryEntry is an entry of a fragment's history.

type FragmentVisibility added in v0.53.0

type FragmentVisibility int

FragmentVisibility specifies the kind of visibility a fragment has.

const (
	// FragmentVisibilityUnspecified is an unspecified visibility.
	FragmentVisibilityUnspecified FragmentVisibility = iota
	// FragmentVisibilityPrivate restricts access to a fragment to its organization.
	FragmentVisibilityPrivate
	// FragmentVisibilityPublic allows the fragment to be accessible to everyone.
	FragmentVisibilityPublic
	// FragmentVisibilityPublicUnlisted allows the fragment to be accessible to everyone but is hidden from public listings like it is private.
	FragmentVisibilityPublicUnlisted
)

type GetCurrentMonthUsageResponse added in v0.53.0

type GetCurrentMonthUsageResponse struct {
	StartDate                  *time.Time
	EndDate                    *time.Time
	ResourceUsageCostsBySource []*ResourceUsageCostsBySource
	Subtotal                   float64
}

GetCurrentMonthUsageResponse contains the current month usage information.

type GetDatabaseConnectionResponse added in v0.55.0

type GetDatabaseConnectionResponse struct {
	Hostname        string
	MongodbURI      string
	HasDatabaseUser bool
}

GetDatabaseConnectionResponse represents the response returned by GetDatabaseConnection. It contains the hostname endpoint, a URI for connecting to the MongoDB Atlas Data Federation instance, and a flag indicating whether a database user is configured for the Viam organization.

type GetFragmentHistoryOptions added in v0.53.0

type GetFragmentHistoryOptions struct {
	PageToken *string
	PageLimit *int
}

GetFragmentHistoryOptions contains optional parameters for GetFragmentHistory.

type GetLatestTabularDataResponse added in v0.55.0

type GetLatestTabularDataResponse struct {
	TimeCaptured time.Time
	TimeSynced   time.Time
	Payload      map[string]interface{}
}

GetLatestTabularDataResponse represents the response returned by GetLatestTabularData. It contains the most recently captured data payload, the time it was captured, and the time it was synced.

type GetOrgBillingInformationResponse added in v0.53.0

type GetOrgBillingInformationResponse struct {
	Type         PaymentMethodType
	BillingEmail string
	// defined if type is PaymentMethodTypeCard
	Method *PaymentMethodCard
	// only return for billing dashboard admin users
	BillingTier *string
}

GetOrgBillingInformationResponse contains the information of an organization's billing information.

type GetRobotPartLogsOptions added in v0.53.0

type GetRobotPartLogsOptions struct {
	Filter *string
	// PageToken represents the page to receive logs from. The function defaults to the most recent page if PageToken is empty.
	PageToken *string
	// Levels represents the levels of the logs requested. Logs of all levels are returned when levels is empty.
	Levels []string
	Start  *time.Time
	End    *time.Time
	Limit  *int
	Source *string
}

GetRobotPartLogsOptions contains optional parameters for GetRobotPartLogs.

type GetSmartMachineStatusResponse added in v0.53.0

type GetSmartMachineStatusResponse struct {
	ProvisioningInfo           *ProvisioningInfo
	HasSmartMachineCredentials bool
	IsOnline                   bool
	LastestConnectionAttempt   *NetworkInfo
	Errors                     []string
}

GetSmartMachineStatusResponse contains smart machine status information.

type GetTrainingJobLogsOptions added in v0.54.0

type GetTrainingJobLogsOptions struct {
	PageToken *string
}

GetTrainingJobLogsOptions contains optional parameters for GetTrainingJobLogs.

type InvoiceSummary added in v0.53.0

type InvoiceSummary struct {
	ID            string
	InvoiceDate   *time.Time
	InvoiceAmount float64
	Status        string
	DueDate       *time.Time
	PaidDate      *time.Time
}

InvoiceSummary holds the information of an invoice summary.

type ListDataPipelineRunsPage added in v0.73.0

type ListDataPipelineRunsPage struct {
	Runs []*DataPipelineRun
	// contains filtered or unexported fields
}

ListDataPipelineRunsPage is a results page of data pipeline runs, used for pagination.

func (*ListDataPipelineRunsPage) NextPage added in v0.73.0

NextPage retrieves the next page of data pipeline runs.

type ListModulesOptions added in v0.53.0

type ListModulesOptions struct {
	// OrgID is the organization to return private modules for.
	OrgID *string
}

ListModulesOptions contains optional parameters for ListModules.

type ListRegistryItemsOptions added in v0.53.0

type ListRegistryItemsOptions struct {
	SearchTerm *string
	PageToken  *string
	// PublicNamespaces are the namespaces to return results for.
	PublicNamespaces []string
}

ListRegistryItemsOptions contains optional parameters for ListRegistryItems.

type Location added in v0.53.0

type Location struct {
	ID               string
	Name             string
	ParentLocationID string
	Auth             *LocationAuth
	Organizations    []*LocationOrganization
	CreatedOn        *time.Time
	RobotCount       int
	Config           *StorageConfig
}

Location holds the information of a specific location.

type LocationAuth added in v0.53.0

type LocationAuth struct {
	LocationID string
	Secrets    []*SharedSecret
}

LocationAuth holds the secrets used to authenticate to a location.

type LocationOrganization added in v0.53.0

type LocationOrganization struct {
	OrganizationID string
	Primary        bool
}

LocationOrganization holds information of an organization the location is shared with.

type LocationSummary added in v0.110.0

type LocationSummary struct {
	LocationID       string
	LocationName     string
	MachineSummaries []*MachineSummary
}

LocationSummary contains summaries of machines housed under some location with its ID and name.

type LogEntry added in v0.53.0

type LogEntry struct {
	Host       string
	Level      string
	Time       *time.Time
	LoggerName string
	Message    string
	Caller     map[string]interface{}
	Stack      string
	Fields     []map[string]interface{}
}

LogEntry holds the information of a single log entry.

type MLModelMetadata added in v0.53.0

type MLModelMetadata struct {
	Versions       []*MLModelVersion
	ModelType      ModelType
	ModelFramework ModelFramework
}

MLModelMetadata holds the metadata for a ML model.

type MLModelVersion added in v0.112.0

type MLModelVersion struct {
	Version   string
	CreatedOn *time.Time
}

MLModelVersion is the version of a ML model.

type MLTrainingClient added in v0.54.0

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

MLTrainingClient is a gRPC client for method calls to the ML Training API.

func (*MLTrainingClient) CancelTrainingJob added in v0.54.0

func (c *MLTrainingClient) CancelTrainingJob(ctx context.Context, id string) error

CancelTrainingJob cancels a training job that has not yet completed.

func (*MLTrainingClient) DeleteCompletedTrainingJob added in v0.54.0

func (c *MLTrainingClient) DeleteCompletedTrainingJob(ctx context.Context, id string) error

DeleteCompletedTrainingJob removes a completed training job from the database, whether the job succeeded or failed.

func (*MLTrainingClient) GetTrainingJob added in v0.54.0

func (c *MLTrainingClient) GetTrainingJob(ctx context.Context, id string) (*TrainingJobMetadata, error)

GetTrainingJob retrieves a training job by its ID.

func (*MLTrainingClient) GetTrainingJobLogs added in v0.54.0

func (c *MLTrainingClient) GetTrainingJobLogs(
	ctx context.Context, id string, opts *GetTrainingJobLogsOptions,
) ([]*TrainingJobLogEntry, string, error)

GetTrainingJobLogs gets the logs and the next page token for a given custom training job.

func (*MLTrainingClient) ListTrainingJobs added in v0.54.0

func (c *MLTrainingClient) ListTrainingJobs(
	ctx context.Context, organizationID string, status TrainingStatus,
) ([]*TrainingJobMetadata, error)

ListTrainingJobs lists training jobs for a given organization ID and training status.

func (*MLTrainingClient) SubmitCustomTrainingJob added in v0.54.0

func (c *MLTrainingClient) SubmitCustomTrainingJob(
	ctx context.Context, args SubmitTrainingJobArgs, registryItemID, registryItemVersion string, arguments map[string]string,
) (string, error)

SubmitCustomTrainingJob submits a custom training job request and returns its ID.

func (*MLTrainingClient) SubmitTrainingJob added in v0.54.0

func (c *MLTrainingClient) SubmitTrainingJob(
	ctx context.Context, args SubmitTrainingJobArgs, modelType ModelType, tags []string,
) (string, error)

SubmitTrainingJob submits a training job request and returns its ID.

type MLTrainingMetadata added in v0.53.0

type MLTrainingMetadata struct {
	Versions       []*MLTrainingVersion
	ModelType      ModelType
	ModelFramework ModelFramework
	Draft          bool
}

MLTrainingMetadata is the metadata of an ML Training.

type MLTrainingVersion added in v0.53.0

type MLTrainingVersion struct {
	Version   string
	CreatedOn *time.Time
}

MLTrainingVersion is the version of ML Training.

type MachineSummary added in v0.110.0

type MachineSummary struct {
	MachineID   string
	MachineName string
}

MachineSummary contains a single machine's ID and name.

type MimeType added in v0.52.0

type MimeType int32

MimeType specifies the format of a file being uploaded.

const (
	MimeTypeUnspecified MimeType = iota
	MimeTypeJPEG
	MimeTypePNG
	MimeTypePCD
)

MimeType constants define the possible MimeType options.

type Model added in v0.53.0

type Model struct {
	API   string
	Model string
}

Model holds the colon-delimited-triplet of the model and the API implemented by the model.

type ModelFramework added in v0.53.0

type ModelFramework int

ModelFramework is the framework type of a model.

const (
	// ModelFrameworkUnspecified is an unspecified model framework.
	ModelFrameworkUnspecified ModelFramework = iota
	// ModelFrameworkTFLite specifies a TFLite model framework.
	ModelFrameworkTFLite
	// ModelFrameworkTensorFlow specifies a TensorFlow model framework.
	ModelFrameworkTensorFlow
	// ModelFrameworkPyTorch specifies a PyTorch model framework.
	ModelFrameworkPyTorch
	// ModelFrameworkONNX specifies a ONNX model framework.
	ModelFrameworkONNX
)

type ModelType added in v0.53.0

type ModelType int

ModelType specifies the type of model used for classification or detection.

const (
	// ModelTypeUnspecified represents an unspecified model.
	ModelTypeUnspecified ModelType = iota
	// ModelTypeSingleLabelClassification represents a single-label classification model.
	ModelTypeSingleLabelClassification
	// ModelTypeMultiLabelClassification represents a multi-label classification model.
	ModelTypeMultiLabelClassification
	// ModelTypeObjectDetection represents an object detection model.
	ModelTypeObjectDetection
)

type Module added in v0.53.0

type Module struct {
	ModuleID               string
	Name                   string
	Visibility             Visibility
	Versions               []*VersionHistory
	URL                    string
	Description            string
	Models                 []*Model
	Apps                   []*App
	TotalRobotUsage        int
	TotalOrganizationUsage int
	OrganizationID         string
	Entrypoint             string
	PublicNamespace        string
	FirstRun               *string
}

Module holds the information of a module.

type ModuleFileInfo added in v0.53.0

type ModuleFileInfo struct {
	ModuleID     string
	Version      string
	Platform     string
	PlatformTags []string
}

ModuleFileInfo holds the information of a module file.

type ModuleMetadata added in v0.53.0

type ModuleMetadata struct {
	Models     []*Model
	Apps       []*App
	Versions   []*ModuleVersion
	Entrypoint string
	FirstRun   *string
}

ModuleMetadata holds the metadata of a module.

type ModuleVersion added in v0.53.0

type ModuleVersion struct {
	Version    string
	Files      []*Uploads
	Models     []*Model
	Apps       []*App
	Entrypoint string
	FirstRun   *string
}

ModuleVersion holds the information of a module version.

type NetworkInfo added in v0.53.0

type NetworkInfo struct {
	Type      string
	SSID      string
	Security  string
	Signal    int
	Connected bool
	LastError string
}

NetworkInfo holds network information.

type Options

type Options struct {
	BaseURL     string
	Entity      string
	Credentials rpc.Credentials
	DialOptions []rpc.DialOption
}

Options has the options necessary to connect through gRPC.

func WithDialOptions added in v0.99.0

func WithDialOptions(opts ...rpc.DialOption) Options

WithDialOptions creates a new Options struct with the given dial options.

type Order added in v0.52.0

type Order int32

Order specifies the order in which data is returned.

const (
	Unspecified Order = iota
	Descending
	Ascending
)

Order constants define the possible ordering options.

type OrgDetails added in v0.53.0

type OrgDetails struct {
	OrgID   string
	OrgName string
}

OrgDetails holds the ID and name of the organization.

type Organization added in v0.53.0

type Organization struct {
	ID              string
	Name            string
	CreatedOn       *time.Time
	PublicNamespace string
	DefaultRegion   string
	Cid             *string
}

Organization holds the information of an organization.

type OrganizationIdentity added in v0.53.0

type OrganizationIdentity struct {
	ID   string
	Name string
}

OrganizationIdentity is used to render an organization's information on the frontend.

type OrganizationInvite added in v0.53.0

type OrganizationInvite struct {
	OrganizationID string
	Email          string
	CreatedOn      *time.Time
	Authorizations []*Authorization
}

OrganizationInvite is the invite to an organization.

type OrganizationMember added in v0.53.0

type OrganizationMember struct {
	UserID    string
	Emails    []string
	DateAdded *time.Time
	LastLogin *time.Time
}

OrganizationMember holds the information of a member of an organization.

type PackageType added in v0.53.0

type PackageType int

PackageType is the type of package being used.

const (
	// PackageTypeUnspecified represents an unspecified package type.
	PackageTypeUnspecified PackageType = iota
	// PackageTypeArchive represents an archive package type.
	PackageTypeArchive
	// PackageTypeMLModel represents a ML model package type.
	PackageTypeMLModel
	// PackageTypeModule represents a module package type.
	PackageTypeModule
	// PackageTypeSLAMMap represents a SLAM map package type.
	PackageTypeSLAMMap
	// PackageTypeMLTraining represents a ML training package type.
	PackageTypeMLTraining
)

type PaymentMethodCard added in v0.53.0

type PaymentMethodCard struct {
	Brand          string
	LastFourDigits string
}

PaymentMethodCard holds the information of a card used for payment.

type PaymentMethodType added in v0.53.0

type PaymentMethodType int

PaymentMethodType is the type of payment method.

const (
	// PaymentMethodTypeUnspecified represents an unspecified payment method.
	PaymentMethodTypeUnspecified PaymentMethodType = iota
	// PaymentMethodtypeCard represents a payment by card.
	PaymentMethodtypeCard
	// PaymentMethodTypeUSBankAccount represents a payment by US Bank Account.
	PaymentMethodTypeUSBankAccount
)

type ProvisioningClient added in v0.53.0

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

ProvisioningClient is a gRPC client for method calls to the Provisioning API.

func (*ProvisioningClient) GetNetworkList added in v0.53.0

func (c *ProvisioningClient) GetNetworkList(ctx context.Context) ([]*NetworkInfo, error)

GetNetworkList gets the list of networks that are visible to the smart machine.

func (*ProvisioningClient) GetSmartMachineStatus added in v0.53.0

func (c *ProvisioningClient) GetSmartMachineStatus(ctx context.Context) (*GetSmartMachineStatusResponse, error)

GetSmartMachineStatus gets the status of the smart machine including networking.

func (*ProvisioningClient) SetNetworkCredentials added in v0.53.0

func (c *ProvisioningClient) SetNetworkCredentials(ctx context.Context, credentialsType, ssid, psk string) error

SetNetworkCredentials sets the wifi credentials.

func (*ProvisioningClient) SetSmartMachineCredentials added in v0.53.0

func (c *ProvisioningClient) SetSmartMachineCredentials(ctx context.Context, cloud *CloudConfig) error

SetSmartMachineCredentials sets the smart machine credentials.

type ProvisioningInfo added in v0.53.0

type ProvisioningInfo struct {
	FragmentID   string
	Model        string
	Manufacturer string
}

ProvisioningInfo holds provisioning info.

type RegistryItem added in v0.53.0

type RegistryItem struct {
	ItemID                         string
	OrganizationID                 string
	PublicNamespace                string
	Name                           string
	Type                           PackageType
	Visibility                     Visibility
	URL                            string
	Description                    string
	TotalRobotUsage                int
	TotalExternalRobotUsage        int
	TotalOrganizationUsage         int
	TotalExternalOrganizationUsage int
	Metadata                       isRegistryItemMetadata
	CreatedAt                      *time.Time
	UpdatedAt                      *time.Time
}

RegistryItem has the information of an item in the registry.

type RegistryItemStatus added in v0.53.0

type RegistryItemStatus int

RegistryItemStatus specifies if a registry item is published or in development.

const (
	// RegistryItemStatusUnspecified is an unspecified registry item status.
	RegistryItemStatusUnspecified RegistryItemStatus = iota
	// RegistryItemStatusPublished represents a published registry item.
	RegistryItemStatusPublished
	// RegistryItemStatusInDevelopment represents a registry item still in development.
	RegistryItemStatusInDevelopment
)

type ResourceUsageCosts added in v0.53.0

type ResourceUsageCosts struct {
	UsageCosts           []*UsageCost
	Discount             float64
	TotalWithDiscount    float64
	TotalWithoutDiscount float64
}

ResourceUsageCosts holds the usage costs with discount information.

type ResourceUsageCostsBySource added in v0.53.0

type ResourceUsageCostsBySource struct {
	SourceType         SourceType
	ResourceUsageCosts *ResourceUsageCosts
	TierName           string
}

ResourceUsageCostsBySource contains the resource usage costs of a source.

type Robot added in v0.53.0

type Robot struct {
	ID         string
	Name       string
	Location   string
	LastAccess *time.Time
	CreatedOn  *time.Time
}

Robot holds the information of a machine.

type RobotPart added in v0.53.0

type RobotPart struct {
	ID               string
	Name             string
	DNSName          string
	Secret           string
	Robot            string
	LocationID       string
	RobotConfig      map[string]interface{}
	LastAccess       *time.Time
	UserSuppliedInfo map[string]interface{}
	MainPart         bool
	FQDN             string
	LocalFQDN        string
	CreatedOn        *time.Time
	Secrets          []*SharedSecret
	LastUpdated      *time.Time
}

RobotPart is a specific machine part.

type RobotPartHistoryEntry added in v0.53.0

type RobotPartHistoryEntry struct {
	Part     string
	Robot    string
	When     *time.Time
	Old      *RobotPart
	EditedBy *AuthenticatorInfo
}

RobotPartHistoryEntry is a history entry of a robot part.

type RobotPartLogStream added in v0.53.0

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

RobotPartLogStream is a stream with robot part logs.

func (*RobotPartLogStream) Next added in v0.53.0

func (s *RobotPartLogStream) Next() ([]*LogEntry, error)

Next gets the next slice of robot part log entries.

type RoverRentalRobot added in v0.53.0

type RoverRentalRobot struct {
	RobotID         string
	LocationID      string
	RobotName       string
	RobotMainPartID string
}

RoverRentalRobot holds the information of a rover rental robot.

type SensorData added in v0.52.0

type SensorData struct {
	Metadata SensorMetadata
	SDStruct map[string]interface{}
	SDBinary []byte
}

SensorData contains the contents and metadata for tabular data.

type SensorMetadata added in v0.52.0

type SensorMetadata struct {
	TimeRequested time.Time
	TimeReceived  time.Time
	MimeType      MimeType
	Annotations   *Annotations
}

SensorMetadata contains the time the sensor data was requested and was received.

type SharedSecret added in v0.53.0

type SharedSecret struct {
	ID        string
	CreatedOn *time.Time
	State     SharedSecretState
}

SharedSecret is a secret used for LocationAuth and RobotParts.

type SharedSecretState added in v0.53.0

type SharedSecretState int

SharedSecretState specifies if the secret is enabled, disabled, or unspecified.

const (
	// SharedSecretStateUnspecified represents an unspecified shared secret state.
	SharedSecretStateUnspecified SharedSecretState = iota
	// SharedSecretStateEnabled represents an enabled secret that can be used in authentication.
	SharedSecretStateEnabled
	// SharedSecretStateDisabled represents a disabled secret that must not be used to authenticate to rpc.
	SharedSecretStateDisabled
)

type SourceType added in v0.53.0

type SourceType int

SourceType is the type of source from which a cost is coming from.

const (
	// SourceTypeUnspecified represents an unspecified source type.
	SourceTypeUnspecified SourceType = iota
	// SourceTypeOrg represents an organization.
	SourceTypeOrg
	// SourceTypeFragment represents a fragment.
	SourceTypeFragment
)

type StorageConfig added in v0.53.0

type StorageConfig struct {
	Region string
}

StorageConfig holds the GCS region that data is stored in.

type StreamingDataCaptureUploadOptions added in v0.54.0

type StreamingDataCaptureUploadOptions struct {
	ComponentType    *string
	ComponentName    *string
	MethodName       *string
	Type             *DataType
	FileName         *string
	MethodParameters map[string]interface{}
	Tags             []string
	DatasetIDs       []string
	DataRequestTimes *[2]time.Time
}

StreamingDataCaptureUploadOptions represents optional parameters for the StreamingDataCaptureUpload method.

type SubmitTrainingJobArgs added in v0.54.0

type SubmitTrainingJobArgs struct {
	DatasetID      string
	OrganizationID string
	ModelName      string
	ModelVersion   string
}

SubmitTrainingJobArgs contains the necessary training job information to submit the job.

type TabularData added in v0.52.0

type TabularData struct {
	Data          map[string]interface{}
	MetadataIndex int
	Metadata      *CaptureMetadata
	TimeRequested time.Time
	TimeReceived  time.Time
}

TabularData contains data and metadata associated with tabular data.

type TabularDataByFilterResponse added in v0.55.0

type TabularDataByFilterResponse struct {
	TabularData []*TabularData
	Count       int
	Last        string
}

TabularDataByFilterResponse represents the result of a TabularDataByFilter query. It contains the retrieved tabular data and associated metadata, the total number of entries retrieved (Count), and the ID of the last returned page (Last).

type TabularDataByMQLOptions added in v0.63.0

type TabularDataByMQLOptions struct {
	// UseRecentData turns on reading from hot storage.
	// Deprecated - use TabularDataSourceTypeHotStorage instead.
	UseRecentData bool
	// TabularDataSourceType specifies the source of the tabular data.
	TabularDataSourceType TabularDataSourceType
	// PipelineID is the ID of the pipeline to query. Required if TabularDataSourceType
	// is TabularDataSourceTypePipelineSink.
	PipelineID string
	// QueryPrefixName specifies the name of the saved query to prepend to the provided MQL query.
	QueryPrefixName string
}

TabularDataByMQLOptions contains optional parameters for TabularDataByMQL.

type TabularDataCaptureUploadOptions added in v0.54.0

type TabularDataCaptureUploadOptions struct {
	Type             *DataType
	FileName         *string
	MethodParameters map[string]interface{}
	FileExtension    *string
	Tags             []string
}

TabularDataCaptureUploadOptions represents optional parameters for the TabularDataCaptureUpload method.

type TabularDataOptions added in v0.84.0

type TabularDataOptions struct {
	AdditionalParameters map[string]interface{}
}

TabularDataOptions contains optional parameters for GetLatestTabularData and ExportTabularData.

type TabularDataSourceType added in v0.73.0

type TabularDataSourceType int32

TabularDataSourceType specifies the data source type for TabularDataByMQL queries.

const (
	TabularDataSourceTypeUnspecified TabularDataSourceType = iota
	// TabularDataSourceTypeStandard indicates reading from standard storage. This is the default
	// option and available for all data synced to Viam.
	TabularDataSourceTypeStandard
	// TabularDataSourceTypeHotStorage indicates reading from hot storage. This is a premium feature
	// requiring opting in specific data sources.
	// See docs at https://docs.viam.com/data-ai/capture-data/advanced/advanced-data-capture-sync/#capture-to-the-hot-data-store
	TabularDataSourceTypeHotStorage
	// TabularDataSourceTypePipelineSink indicates reading the output of a data pipeline.
	// When using this, a pipeline ID needs to be specified.
	TabularDataSourceTypePipelineSink
)

TabularDataSourceType constants define the possible TabularDataSourceType options.

type TagsFilter added in v0.52.0

type TagsFilter struct {
	Type TagsFilterType
	Tags []string
}

TagsFilter defines the type of filtering and, if applicable, over which tags to perform a logical OR.

type TagsFilterType added in v0.52.0

type TagsFilterType int32

TagsFilterType specifies how data can be filtered based on tags.

const (
	TagsFilterTypeUnspecified TagsFilterType = iota
	TagsFilterTypeMatchByOr
	TagsFilterTypeTagged
	TagsFilterTypeUntagged
)

TagsFilterType constants define the ways data can be filtered based on tag matching criteria.

type TailRobotPartLogsOptions added in v0.53.0

type TailRobotPartLogsOptions struct {
	Filter *string
}

TailRobotPartLogsOptions contains optional parameters for TailRobotPartLogs.

type TextOverrides added in v0.110.0

type TextOverrides struct {
	Fields map[string]string
}

TextOverrides contains the text Viam App developers want displayed on the Viam Apps "machine picker" page.

type TrainingJobLogEntry added in v0.54.0

type TrainingJobLogEntry struct {
	Level   string
	Time    *time.Time
	Message string
}

TrainingJobLogEntry is a log entry from a training job.

type TrainingJobMetadata added in v0.54.0

type TrainingJobMetadata struct {
	ID                  string
	DatasetID           string
	OrganizationID      string
	ModelName           string
	ModelVersion        string
	ModelType           ModelType
	ModelFramework      ModelFramework
	IsCustomJob         bool
	RegistryItemID      string
	RegistryItemVersion string
	Status              TrainingStatus
	ErrorStatus         *status.Status
	CreatedOn           *time.Time
	LastModified        *time.Time
	TrainingStarted     *time.Time
	TrainingEnded       *time.Time
	SyncedModelID       string
	Tags                []string
}

TrainingJobMetadata contains the metadata for a training job.

type TrainingStatus added in v0.54.0

type TrainingStatus int

TrainingStatus respresents the status of a training job.

const (
	// TrainingStatusUnspecified respresents an unspecified training status.
	TrainingStatusUnspecified TrainingStatus = iota
	// TrainingStatusPending respresents a pending training job.
	TrainingStatusPending
	// TrainingStatusInProgress respresents a training job that is in progress.
	TrainingStatusInProgress
	// TrainingStatusCompleted respresents a completed training job.
	TrainingStatusCompleted
	// TrainingStatusFailed respresents a failed training job.
	TrainingStatusFailed
	// TrainingStatusCanceled respresents a canceled training job.
	TrainingStatusCanceled
	// TrainingStatusCanceling respresents a training job that is being canceled.
	TrainingStatusCanceling
)

type UpdateBoundingBoxOptions added in v0.54.0

type UpdateBoundingBoxOptions struct {
	Label *string

	// Normalized coordinates where all coordinates must be in the range [0, 1].
	XMinNormalized *float64
	YMinNormalized *float64
	XMaxNormalized *float64
	YMaxNormalized *float64
}

UpdateBoundingBoxOptions contains optional parameters for UpdateBoundingBox.

type UpdateFragmentOptions added in v0.53.0

type UpdateFragmentOptions struct {
	Public     *bool
	Visibility *FragmentVisibility
}

UpdateFragmentOptions contains optional parameters for UpdateFragment.

type UpdateLocationOptions added in v0.53.0

type UpdateLocationOptions struct {
	Name *string
	// PArentLocationID is the new parent location to move the location under.
	ParentLocationID *string
	// Region is the GCS region to associate the location with.
	Region *string
}

UpdateLocationOptions contains optional parameters for UpdateLocation.

type UpdateModuleOptions added in v0.53.0

type UpdateModuleOptions struct {
	// The path to a setup script that is run before a newly downloaded module starts.
	FirstRun *string
}

UpdateModuleOptions contains optional parameters for UpdateModule.

type UpdateOrganizationOptions added in v0.53.0

type UpdateOrganizationOptions struct {
	Name      *string
	Namespace *string
	// Region is the new GCS region to associate the org with.
	Region *string
	CID    *string
}

UpdateOrganizationOptions contains optional parameters for UpdateOrganization.

type UpdateRegistryItemOptions added in v0.53.0

type UpdateRegistryItemOptions struct {
	URL *string
}

UpdateRegistryItemOptions contains optional parameters for UpdateRegistryItem.

type UploadMetadata added in v0.52.0

type UploadMetadata struct {
	PartID           string
	ComponentType    string
	ComponentName    string
	MethodName       string
	Type             DataType
	FileName         string
	MethodParameters map[string]interface{}
	FileExtension    string
	Tags             []string
	DatasetIDs       []string
}

UploadMetadata contains the metadata for binary (image + file) data.

type Uploads added in v0.53.0

type Uploads struct {
	Platform   string
	UploadedAt *time.Time
}

Uploads holds the time the file was uploaded and the OS and architecture a module is built to run on.

type UsageCost added in v0.53.0

type UsageCost struct {
	ResourceType UsageCostType
	Cost         float64
}

UsageCost contains the cost and cost type.

type UsageCostType added in v0.53.0

type UsageCostType int

UsageCostType specifies the type of usage cost.

const (
	// UsageCostTypeUnspecified is an unspecified usage cost type.
	UsageCostTypeUnspecified UsageCostType = iota
	// UsageCostTypeDataUpload represents the usage cost from data upload.
	UsageCostTypeDataUpload
	// UsageCostTypeDataEgress represents the usage cost from data egress.
	UsageCostTypeDataEgress
	// UsageCostTypeRemoteControl represents the usage cost from remote control.
	UsageCostTypeRemoteControl
	// UsageCostTypeStandardCompute represents the usage cost from standard compute.
	UsageCostTypeStandardCompute
	// UsageCostTypeCloudStorage represents the usage cost from cloud storage.
	UsageCostTypeCloudStorage
	// UsageCostTypeBinaryDataCloudStorage represents the usage cost from binary data cloud storage.
	UsageCostTypeBinaryDataCloudStorage
	// UsageCostTypeOtherCloudStorage represents the usage cost from other cloud storage.
	UsageCostTypeOtherCloudStorage
	// UsageCostTypePerMachine represents the usage cost per machine.
	UsageCostTypePerMachine
)

type VersionHistory added in v0.53.0

type VersionHistory struct {
	Version    string
	Files      []*Uploads
	Models     []*Model
	Apps       []*App
	Entrypoint string
	FirstRun   *string
}

VersionHistory holds the history of a version.

type ViamClient

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

ViamClient is a gRPC client for method calls to Viam app.

func ConnectFromCLIToken added in v0.111.0

func ConnectFromCLIToken(ctx context.Context, logger logging.Logger) (*ViamClient, error)

ConnectFromCLIToken creates a ViamClient using cached CLI credentials.

func CreateViamClientFromEnvVars added in v0.68.0

func CreateViamClientFromEnvVars(ctx context.Context, options *Options, logger logging.Logger) (*ViamClient, error)

CreateViamClientFromEnvVars creates a ViamClient using credentials set in the environment as `VIAM_API_KEY` and `VIAM_API_KEY_ID`. These will typically be set by the module manager and this API is primarily intended for use within modular resources, though can be used in another context so long as the user manually sets the appropriate env vars.

func CreateViamClientWithAPIKey

func CreateViamClientWithAPIKey(
	ctx context.Context, options Options, apiKey, apiKeyID string, logger logging.Logger,
) (*ViamClient, error)

CreateViamClientWithAPIKey creates a ViamClient with an API key.

func CreateViamClientWithOptions

func CreateViamClientWithOptions(ctx context.Context, options Options, logger logging.Logger) (*ViamClient, error)

CreateViamClientWithOptions creates a ViamClient with an Options struct.

func (*ViamClient) AppClient added in v0.53.0

func (c *ViamClient) AppClient() *AppClient

AppClient initializes and returns an AppClient instance used to make app method calls. To use AppClient, you must first instantiate a ViamClient.

func (*ViamClient) BillingClient added in v0.53.0

func (c *ViamClient) BillingClient() *BillingClient

BillingClient initializes and returns a BillingClient instance used to make app method calls. To use BillingClient, you must first instantiate a ViamClient.

func (*ViamClient) Close

func (c *ViamClient) Close() error

Close closes the gRPC connection.

func (*ViamClient) DataClient added in v0.52.0

func (c *ViamClient) DataClient() *DataClient

DataClient initializes and returns a DataClient instance used to make data method calls. To use DataClient, you must first instantiate a ViamClient.

func (*ViamClient) MLTrainingClient added in v0.54.0

func (c *ViamClient) MLTrainingClient() *MLTrainingClient

MLTrainingClient initializes and returns a MLTrainingClient instance used to make ML training method calls. To use MLTrainingClient, you must first instantiate a ViamClient.

func (*ViamClient) ProvisioningClient added in v0.53.0

func (c *ViamClient) ProvisioningClient() *ProvisioningClient

ProvisioningClient initializes and returns a ProvisioningClient instance used to make provisioning method calls. To use ProvisioningClient, you must first instantiate a ViamClient.

type Visibility added in v0.53.0

type Visibility int

Visibility specifies the type of visibility of a registry item.

const (
	// VisibilityUnspecified represents an unspecified visibility.
	VisibilityUnspecified Visibility = iota
	// VisibilityPrivate are for registry items visible only within the owning org.
	VisibilityPrivate
	// VisibilityPublic are for registry items that are visible to everyone.
	VisibilityPublic
	// VisibilityPublicUnlisted are for registry items usable in everyone's robot but are hidden from the registry page as if they are private.
	VisibilityPublicUnlisted
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL