commands

package
v2.20.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Overview

Package commands contains the definition for all the commands present in Hasura CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteVersions

func DeleteVersions(ec *cli.ExecutionContext, versions []uint64, source cli.Source) error

func Execute

func Execute() error

Execute executes the command and returns the error

func ExecuteMigration

func ExecuteMigration(cmd string, t *migrate.Migrate, stepOrVersion int64) error

ExecuteMigration runs the actual migration

func HandlePluginCommand

func HandlePluginCommand(pluginHandler PluginHandler, cmdArgs []string) error

HandlePluginCommand receives a pluginHandler and command-line arguments and attempts to find a plugin executable on the PATH that satisfies the given arguments.

func NewActionsCmd

func NewActionsCmd(ec *cli.ExecutionContext) *cobra.Command

NewActionsCmd returns the actions command

func NewCompletionCmd

func NewCompletionCmd(ec *cli.ExecutionContext) *cobra.Command

NewCompletionCmd return the completion command.

func NewConsoleCmd

func NewConsoleCmd(ec *cli.ExecutionContext) *cobra.Command

NewConsoleCmd returns the console command

func NewDefaultHasuraCommand

func NewDefaultHasuraCommand() *cobra.Command

NewDefaultHasuraCommand creates the `hasura` command with default arguments

func NewDefaultHasuraCommandWithArgs

func NewDefaultHasuraCommandWithArgs(pluginHandler PluginHandler, args []string, in io.Reader, out, errout io.Writer) *cobra.Command

NewDefaultHasuraCommandWithArgs creates the `hasura` command with arguments

func NewDeployCmd

func NewDeployCmd(ec *cli.ExecutionContext) *cobra.Command

func NewDocsCmd

func NewDocsCmd(ec *cli.ExecutionContext) *cobra.Command

NewDocsCmd returns the docs command

func NewHelpCmd

func NewHelpCmd(ec *cli.ExecutionContext) *cobra.Command

NewHelpCmd returns the help command

func NewInitCmd

func NewInitCmd(ec *cli.ExecutionContext) *cobra.Command

NewInitCmd is the definition for init command

func NewMetadataCmd

func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command

NewMetadataCmd returns the metadata command

func NewMigrateCmd

func NewMigrateCmd(ec *cli.ExecutionContext) *cobra.Command

NewMigrateCmd returns the migrate command

func NewPluginsCmd

func NewPluginsCmd(ec *cli.ExecutionContext) *cobra.Command

NewPluginsCmd returns the plugins command

func NewScriptsCmd

func NewScriptsCmd(ec *cli.ExecutionContext) *cobra.Command

NewScriptsCmd returns the scripts command

func NewSeedCmd

func NewSeedCmd(ec *cli.ExecutionContext) *cobra.Command

NewSeedCmd will return the seed command

func NewUpdateCLICmd

func NewUpdateCLICmd(ec *cli.ExecutionContext) *cobra.Command

NewUpdateCLICmd returns the update-cli command.

func NewVersionCmd

func NewVersionCmd(ec *cli.ExecutionContext) *cobra.Command

NewVersionCmd returns the version command

Types

type ConsoleOptions

type ConsoleOptions struct {
	EC *cli.ExecutionContext

	APIPort     string
	APIHost     *url.URL
	ConsolePort string
	Address     string

	DontOpenBrowser bool

	StaticDir       string
	Browser         string
	UseServerAssets bool
	DataApiUrl      string

	APIServerInterruptSignal     chan os.Signal
	ConsoleServerInterruptSignal chan os.Signal
}

func (*ConsoleOptions) Run

func (o *ConsoleOptions) Run() error

type DefaultPluginHandler

type DefaultPluginHandler struct {
	ValidPrefixes []string
}

DefaultPluginHandler implements PluginHandler

func NewDefaultPluginHandler

func NewDefaultPluginHandler(validPrefixes []string) *DefaultPluginHandler

NewDefaultPluginHandler instantiates the DefaultPluginHandler with a list of given filename prefixes used to identify valid plugin filenames.

func (*DefaultPluginHandler) Execute

func (h *DefaultPluginHandler) Execute(executablePath string, cmdArgs, environment []string) error

Execute implements PluginHandler

func (*DefaultPluginHandler) Lookup

func (h *DefaultPluginHandler) Lookup(filename string) (string, bool)

Lookup implements PluginHandler

type DeployOptions

type DeployOptions struct {
	EC *cli.ExecutionContext

	WithSeeds bool
}

func (*DeployOptions) Run

func (opts *DeployOptions) Run() error

type DiffType

type DiffType string
const DifftypeJSON DiffType = "json"
const DifftypeUnifiedJSON DiffType = "unified-json"
const DifftypeUnifiedYAML DiffType = "unified-yaml"
const DifftypeYAML DiffType = "yaml"

type InitOptions

type InitOptions struct {
	EC *cli.ExecutionContext

	Version               cli.ConfigVersion
	Endpoint              string
	AdminSecret           string
	InitDir               string
	GetMetadataMigrations bool
}

func (*InitOptions) InitRun

func (o *InitOptions) InitRun() error

func (*InitOptions) Run

func (o *InitOptions) Run() error

type MetadataApplyOptions

type MetadataApplyOptions struct {
	EC *cli.ExecutionContext

	FromFile bool
	DryRun   bool

	DisallowInconsistencies bool
	// contains filtered or unexported fields
}

func (*MetadataApplyOptions) Run

func (o *MetadataApplyOptions) Run() error

type MetadataClearOptions

type MetadataClearOptions struct {
	EC *cli.ExecutionContext
}

func (*MetadataClearOptions) Run

func (o *MetadataClearOptions) Run() error

type MetadataDiffOptions

type MetadataDiffOptions struct {
	EC           *cli.ExecutionContext
	Output       io.Writer
	Args         []string
	DiffType     string
	DisableColor bool
	// two Metadata to diff, 2nd is server if it's empty
	Metadata [2]string
}

func (*MetadataDiffOptions) Run

func (o *MetadataDiffOptions) Run() error

type MetadataExportOptions

type MetadataExportOptions struct {
	EC *cli.ExecutionContext
	// contains filtered or unexported fields
}

func (*MetadataExportOptions) Run

func (o *MetadataExportOptions) Run() error

type MetadataModeHandler

type MetadataModeHandler interface {
	Export(*MetadataExportOptions) error
	Apply(*MetadataApplyOptions) error
	Diff(*MetadataDiffOptions) error
}

type MetadataReloadOptions

type MetadataReloadOptions struct {
	EC *cli.ExecutionContext
}

type MigrateApplyOptions

type MigrateApplyOptions struct {
	EC *cli.ExecutionContext

	UpMigration      string
	DownMigration    string
	VersionMigration string
	MigrationType    string
	// version up to which migration chain has to be applied
	GotoVersion     string
	SkipExecution   bool
	DryRun          bool
	Source          cli.Source
	ProgressBarLogs bool
}

func (*MigrateApplyOptions) Apply

func (o *MigrateApplyOptions) Apply() (chan MigrateApplyResult, error)

func (*MigrateApplyOptions) Exec

func (o *MigrateApplyOptions) Exec() error

func (*MigrateApplyOptions) Run

func (o *MigrateApplyOptions) Run() error

func (*MigrateApplyOptions) Validate

func (o *MigrateApplyOptions) Validate() error

type MigrateApplyResult

type MigrateApplyResult struct {
	DatabaseName string
	Message      string
	Error        error
}

type MigrateDeleteOptions

type MigrateDeleteOptions struct {
	EC         *cli.ExecutionContext
	Version    uint64
	All        bool
	Force      bool
	OnlyServer bool

	Source cli.Source
}

func (*MigrateDeleteOptions) Run

func (o *MigrateDeleteOptions) Run() error

func (*MigrateDeleteOptions) RunOnSource added in v2.2.0

func (o *MigrateDeleteOptions) RunOnSource() error

type MigrateStatusOptions

type MigrateStatusOptions struct {
	EC         *cli.ExecutionContext
	Source     cli.Source
	StatusOpts StatusOptions
}

func (*MigrateStatusOptions) Run

func (o *MigrateStatusOptions) Run() error

func (*MigrateStatusOptions) RunOnSource added in v2.2.0

func (o *MigrateStatusOptions) RunOnSource() (*migrate.Status, error)

type PluginHandler

type PluginHandler interface {
	// exists at the given filename, or a boolean false.
	// Lookup will iterate over a list of given prefixes
	// in order to recognize valid plugin filenames.
	// The first filepath to match a prefix is returned.
	Lookup(filename string) (string, bool)
	// Execute receives an executable's filepath, a slice
	// of arguments, and a slice of environment variables
	// to relay to the executable.
	Execute(executablePath string, cmdArgs, environment []string) error
}

PluginHandler is capable of parsing command line arguments and performing executable filename lookups to search for valid plugin files, and execute found plugins. courtesy: kubectl https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go

type PluginInstallOptions

type PluginInstallOptions struct {
	EC *cli.ExecutionContext

	Name         string
	ManifestFile string
	Version      util.VersionFlag
}

func (*PluginInstallOptions) Run

func (o *PluginInstallOptions) Run() error

type PluginUpgradeOptions

type PluginUpgradeOptions struct {
	EC *cli.ExecutionContext

	Name    string
	Version util.VersionFlag
}

func (*PluginUpgradeOptions) Run

type SeedApplyOptions

type SeedApplyOptions struct {
	EC     *cli.ExecutionContext
	Driver *seed.Driver

	// seed file to apply
	FileNames []string
	Source    cli.Source
}

func (*SeedApplyOptions) ApplyOnSource added in v2.2.0

func (o *SeedApplyOptions) ApplyOnSource() error

func (*SeedApplyOptions) Run

func (o *SeedApplyOptions) Run() error

type SeedNewOptions

type SeedNewOptions struct {
	EC     *cli.ExecutionContext
	Driver *seed.Driver

	// filename for the new seed file
	SeedName string
	// table name if seed file has to be created from a database table
	FromTableNames []string

	// seed file that was created
	FilePath string
	Source   cli.Source
}

func (*SeedNewOptions) Run

func (o *SeedNewOptions) Run() error

type StatusOptions added in v2.2.0

type StatusOptions map[cli.Source]*migrate.Status

Jump to

Keyboard shortcuts

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