Documentation ¶
Overview ¶
Package cli contains all business logic needed by the CLI command.
Index ¶
- func CreateModuleCommand(c *cli.Context) error
- func UpdateModuleCommand(c *cli.Context) error
- type AppClient
- func (c *AppClient) BinaryData(dst string, filter *datapb.Filter, parallelDownloads uint) error
- func (c *AppClient) Config() *Config
- func (c *AppClient) CreateModule(moduleName, organizationID string) (*apppb.CreateModuleResponse, error)
- func (c *AppClient) DeleteBinaryData(filter *datapb.Filter) error
- func (c *AppClient) DeleteTabularData(filter *datapb.Filter) error
- func (c *AppClient) GetOrg(orgStr string) (*apppb.Organization, error)
- func (c *AppClient) GetUserOrgByPublicNamespace(publicNamespace string) (*apppb.Organization, error)
- func (c *AppClient) ListLocations(orgID string) ([]*apppb.Location, error)
- func (c *AppClient) ListOrganizations() ([]*apppb.Organization, error)
- func (c *AppClient) ListRobots(orgStr, locStr string) ([]*apppb.Robot, error)
- func (c *AppClient) Login() error
- func (c *AppClient) Logout() error
- func (c *AppClient) PrepareAuthorization() (string, string, error)
- func (c *AppClient) PrintRobotPartLogs(orgStr, locStr, robotStr, partStr string, errorsOnly bool, ...) error
- func (c *AppClient) RPCOpts() []rpc.DialOption
- func (c *AppClient) Robot(orgStr, locStr, robotStr string) (*apppb.Robot, error)
- func (c *AppClient) RobotPart(orgStr, locStr, robotStr, partStr string) (*apppb.RobotPart, error)
- func (c *AppClient) RobotPartLogs(orgStr, locStr, robotStr, partStr string) ([]*apppb.LogEntry, error)
- func (c *AppClient) RobotPartLogsErrors(orgStr, locStr, robotStr, partStr string) ([]*apppb.LogEntry, error)
- func (c *AppClient) RobotParts(orgStr, locStr, robotStr string) ([]*apppb.RobotPart, error)
- func (c *AppClient) RunRobotPartCommand(orgStr, locStr, robotStr, partStr string, svcMethod, data string, ...) error
- func (c *AppClient) SelectedLoc() *apppb.Location
- func (c *AppClient) SelectedOrg() *apppb.Organization
- func (c *AppClient) StartRobotPartShell(orgStr, locStr, robotStr, partStr string, debug bool, logger golog.Logger) error
- func (c *AppClient) TabularData(dst string, filter *datapb.Filter) error
- func (c *AppClient) TailRobotPartLogs(orgStr, locStr, robotStr, partStr string, errorsOnly bool, ...) error
- func (c *AppClient) UpdateModule(manifest ModuleManifest, organizationID *string) (*apppb.UpdateModuleResponse, error)
- type Config
- type ModuleComponent
- type ModuleID
- type ModuleManifest
- type ModuleVisibility
- type Token
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateModuleCommand ¶ added in v0.5.0
func CreateModuleCommand(c *cli.Context) error
CreateModuleCommand runs the command to create a module This includes both a gRPC call to register the module on app.viam.com and creating the manifest file.
func UpdateModuleCommand ¶ added in v0.5.0
func UpdateModuleCommand(c *cli.Context) error
UpdateModuleCommand runs the command to update a module. This includes updating the meta.json to include the public namespace (if set on the org).
Types ¶
type AppClient ¶
type AppClient struct {
// contains filtered or unexported fields
}
The AppClient provides all the CLI command functionality needed to talk to the app service but not directly to robot parts.
func NewAppClient ¶
NewAppClient returns a new app client that may already be authenticated.
func (*AppClient) BinaryData ¶ added in v0.1.6
BinaryData downloads binary data matching filter to dst.
func (*AppClient) CreateModule ¶ added in v0.5.0
func (c *AppClient) CreateModule(moduleName, organizationID string) (*apppb.CreateModuleResponse, error)
CreateModule wraps the grpc CreateModule request.
func (*AppClient) DeleteBinaryData ¶ added in v0.2.8
DeleteBinaryData deletes binary data matching filter.
func (*AppClient) DeleteTabularData ¶ added in v0.2.8
DeleteTabularData delete tabular data matching filter.
func (*AppClient) GetOrg ¶ added in v0.5.0
func (c *AppClient) GetOrg(orgStr string) (*apppb.Organization, error)
GetOrg gets an org by an indentifying string. If the orgStr is an org UUID, then this matchs on organization ID, otherwise this will match on organization name.
func (*AppClient) GetUserOrgByPublicNamespace ¶ added in v0.5.0
func (c *AppClient) GetUserOrgByPublicNamespace(publicNamespace string) (*apppb.Organization, error)
GetUserOrgByPublicNamespace searches the logged in users orgs to see if any have a matching public namespace.
func (*AppClient) ListLocations ¶
ListLocations returns all locations in the given organizationbelonging to the currently authenticated user.
func (*AppClient) ListOrganizations ¶
func (c *AppClient) ListOrganizations() ([]*apppb.Organization, error)
ListOrganizations returns all organizations belonging to the currently authenticated user.
func (*AppClient) ListRobots ¶
ListRobots returns all robots in the given location.
func (*AppClient) Login ¶ added in v0.2.14
Login goes through the CLI login flow using a device code and browser. Once logged in the access token and user details are cached on disk.
func (*AppClient) PrepareAuthorization ¶
PrepareAuthorization prepares authorization for this device and returns the device token to late authenticate with and the URL to authorize the device at.
func (*AppClient) PrintRobotPartLogs ¶
func (c *AppClient) PrintRobotPartLogs(orgStr, locStr, robotStr, partStr string, errorsOnly bool, indent, header string) error
PrintRobotPartLogs prints logs for the given robot part.
func (*AppClient) RPCOpts ¶
func (c *AppClient) RPCOpts() []rpc.DialOption
RPCOpts returns RPC dial options dervied from the base URL being used in the current invocation of the CLI.
func (*AppClient) RobotPartLogs ¶
func (c *AppClient) RobotPartLogs(orgStr, locStr, robotStr, partStr string) ([]*apppb.LogEntry, error)
RobotPartLogs returns recent logs for the given robot part.
func (*AppClient) RobotPartLogsErrors ¶
func (c *AppClient) RobotPartLogsErrors(orgStr, locStr, robotStr, partStr string) ([]*apppb.LogEntry, error)
RobotPartLogsErrors returns recent error logs for the given robot part.
func (*AppClient) RobotParts ¶
RobotParts returns all parts of the given robot.
func (*AppClient) RunRobotPartCommand ¶
func (c *AppClient) RunRobotPartCommand( orgStr, locStr, robotStr, partStr string, svcMethod, data string, streamDur time.Duration, debug bool, logger golog.Logger, ) error
RunRobotPartCommand runs the given command on a robot part.
func (*AppClient) SelectedLoc ¶
SelectedLoc returns the currently selected location, possibly zero initialized.
func (*AppClient) SelectedOrg ¶
func (c *AppClient) SelectedOrg() *apppb.Organization
SelectedOrg returns the currently selected organization, possibly zero initialized.
func (*AppClient) StartRobotPartShell ¶
func (c *AppClient) StartRobotPartShell( orgStr, locStr, robotStr, partStr string, debug bool, logger golog.Logger, ) error
StartRobotPartShell starts a shell on a robot part.
func (*AppClient) TabularData ¶ added in v0.1.6
TabularData downloads binary data matching filter to dst.
func (*AppClient) TailRobotPartLogs ¶
func (c *AppClient) TailRobotPartLogs(orgStr, locStr, robotStr, partStr string, errorsOnly bool, indent, header string) error
TailRobotPartLogs tails and prints logs for the given robot part.
func (*AppClient) UpdateModule ¶ added in v0.5.0
func (c *AppClient) UpdateModule(manifest ModuleManifest, organizationID *string) (*apppb.UpdateModuleResponse, error)
UpdateModule wraps the grpc UpdateModule request.
type Config ¶
type Config struct {
Auth *Token `json:"auth"`
}
Config contains stored config information for the CLI.
type ModuleComponent ¶ added in v0.5.0
ModuleComponent represents an api - model pair.
type ModuleManifest ¶ added in v0.5.0
type ModuleManifest struct { Name string `json:"name"` Visibility ModuleVisibility `json:"visibility"` URL string `json:"url"` Description string `json:"description"` Models []ModuleComponent `json:"models"` Entrypoint string `json:"entrypoint"` }
ModuleManifest is used to create & parse manifest.json.
type ModuleVisibility ¶ added in v0.5.0
type ModuleVisibility string
ModuleVisibility determines whether modules are public or private.
const ( ModuleVisibilityPrivate ModuleVisibility = "private" ModuleVisibilityPublic ModuleVisibility = "public" )
Permissions enumeration.
type Token ¶ added in v0.2.14
type Token struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` IDToken string `json:"id_token"` ExpiresAt time.Time `json:"expires_at"` TokenType string `json:"token_type"` TokenURL string `json:"token_url"` ClientID string `json:"client_id"` User UserData `json:"user_data"` }
Token contains an authorization token and details once logged in.
func (*Token) CanRefresh ¶ added in v0.2.14
CanRefresh returns true if the token can be refreshed.