Documentation ¶
Overview ¶
Package cmd provides the command line functions of the crunchy CLI
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI ¶
Package cmd provides the command line functions of the crunchy CLI
Index ¶
Constants ¶
const CAPMAX = 50
const TreeBranch = "\t"
const TreeTrunk = "\t"
Variables ¶
var ( BenchmarkClients int BenchmarkJobs int BenchmarkScale int BenchmarkTransactions int BenchmarkDatabase string BenchmarkInitOpts string BenchmarkOpts string BenchmarkPolicy string BenchmarkUser string )
var APIServerURL string
var AllFlag bool
var ArchiveFlag, AutofailFlag, PgpoolFlag, PgbouncerFlag, MetricsFlag, BadgerFlag bool
var AutofailReplaceReplica string
var AutofailStringFlag string
var BackrestFlag, BackrestRestoreFrom string
var BackrestStorageType string
var BackupOpts string
var BackupPath, BackupPVC string
var BackupType string
var CCPImage string
var CCPImageTag string
var ChangePasswordForUser string
ChangePasswordForUser change password flag
var ClusterReplicaCount int
var ConfigMapName string
unused but coming soon to a theatre near you
var ContainerResources string
var CreateCmd = &cobra.Command{ Use: "create", Short: "Create a Cluster, PGBouncer, PGPool, Policy, Schedule, or User", Long: `CREATE allows you to create a new Cluster, PGBouncer, PGPool, Policy, Schedule or User. For example: pgo create cluster pgo create pgbouncer pgo create pgpool pgo create policy pgo create user`, Run: func(cmd *cobra.Command, args []string) { log.Debug("create called") if len(args) == 0 || (args[0] != "cluster" && args[0] != "policy") && args[0] != "user" { fmt.Println(`Error: You must specify the type of resource to create. Valid resource types include: * cluster * pgbouncer * pgpool * policy * user`) } }, }
var CustomConfig string
var DebugFlag bool
var DeleteBackups bool
var DeleteData bool
flags used by more than 1 command
var DeleteLabel bool
var DeleteUser string
DeleteUser delete user flag
var DryRun bool
var Expired string
Expired expired flag
var GREEN func(a ...interface{}) string
var LabelCmdLabel string
var LabelMap map[string]string
var Labelselector string
var LoadConfig string
var ManagedUser bool
var Namespace string
var NoPrompt bool
var NodeLabel string
var OutputFormat string
var PGBackRestType string
var PGONamespace string
var PGO_CA_CERT, PGO_CLIENT_CERT, PGO_CLIENT_KEY string
var PITRTarget, RestoreBackupPath string
var PVCName string
var PVCRoot string
var Password string
var PasswordAgeDays int
PasswordAgeDays password age flag
var PasswordLength int
PasswordLength password length flag
var PgBouncerPassword string
var PgBouncerUser string
var PgbouncerSecret string
var PgpoolSecret string
var PoliciesFlag, PolicyFile, PolicyURL string
var Query bool
var RED func(a ...interface{}) string
var ReplicaCount int
var ReplicaStorageConfig, StorageConfig string
var RestoreToPVC string
var RestoreType string
var RootCmd = &cobra.Command{
Use: "pgo",
Short: "The pgo command line interface.",
Long: `The pgo command line interface lets you create and manage PostgreSQL clusters.`,
}
RootCmd represents the base command when called without any subcommands
var Schedule string
var ScheduleDatabase string
var ScheduleName string
var ScheduleOptions string
var SchedulePolicy string
var ScheduleSecret string
var ScheduleType string
var Secret string
var SecretFrom string
var Selector string
var Series int
var ServiceType string
var SessionCredentials msgs.BasicAuthCredentials
var ShowBackupCmd = &cobra.Command{ Use: "backup", Short: "Show backup information", Long: `Show backup information. For example: pgo show backup mycluser`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } if len(args) == 0 { fmt.Println("Error: cluster name(s) required for this command.") } else { if showBackupType == "" || showBackupType == config.LABEL_BACKUP_TYPE_BASEBACKUP { showBackup(args, Namespace) } else if showBackupType == config.LABEL_BACKUP_TYPE_BACKREST { showBackrest(args, Namespace) } else if showBackupType == config.LABEL_BACKUP_TYPE_PGDUMP { showpgDump(args, Namespace) } else { fmt.Println("Error: Valid backup-type values are pgbasebackup, pgbackrest and pgdump. The default if not supplied is pgbasebackup.") } } }, }
showBackupCmd represents the show backup command
var ShowBenchmarkCmd = &cobra.Command{ Use: "benchmark", Short: "Show benchmark information", Long: `Show benchmark results for clusters. For example: pgo show benchmark mycluster pgo show benchmark --selector=pg-cluster=mycluster`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } if len(args) == 0 && Selector == "" { fmt.Println("Error: cluster name or selector are required to show benchmark results.") return } showBenchmark(args, Namespace) }, }
ShowBenchmarkCmd represents the show benchmark command
var ShowClusterCmd = &cobra.Command{ Use: "cluster", Short: "Show cluster information", Long: `Show a PostgreSQL cluster. For example: pgo show cluster --all pgo show cluster mycluster`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } if Selector == "" && len(args) == 0 && !AllFlag { fmt.Println("Error: Cluster name(s), --selector, or --all required for this command.") } else { showCluster(args, Namespace) } }, }
ShowClusterCmd represents the show cluster command
var ShowCmd = &cobra.Command{ Use: "show", Short: "Show the description of a cluster", Long: `Show allows you to show the details of a policy, backup, pvc, or cluster. For example: pgo show backup mycluster pgo show backup mycluster --backup-type=pgbackrest pgo show benchmark mycluster pgo show cluster mycluster pgo show config pgo show policy policy1 pgo show pvc mycluster pgo show namespace pgo show workflow 25927091-b343-4017-be4b-71575f0b3eb5 pgo show user mycluster`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { fmt.Println(`Error: You must specify the type of resource to show. Valid resource types include: * backup * benchmark * cluster * config * policy * pvc * namespace * workflow * user `) } else { switch args[0] { case "backup": case "benchmark": case "cluster": case "config": case "policy": case "pvc": case "schedule": case "namespace": case "workflow": case "user": break default: fmt.Println(`Error: You must specify the type of resource to show. Valid resource types include: * backup * benchmark * cluster * config * policy * pvc * namespace * workflow * user`) } } }, }
var ShowConfigCmd = &cobra.Command{ Use: "config", Short: "Show configuration information", Long: `Show configuration information for the Operator. For example: pgo show config`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } showConfig(args, Namespace) }, }
var ShowNamespaceCmd = &cobra.Command{ Use: "namespace", Short: "Show namespace information", Long: `Show namespace information for the Operator. For example: pgo show namespace`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } showNamespace(args, Namespace) }, }
var ShowPVC bool
var ShowPVCCmd = &cobra.Command{ Use: "pvc", Short: "Show PVC information", Long: `Show PVC information. For example: pgo show pvc mycluster pgo show pvc --all pgo show pvc mycluster-backup pgo show pvc mycluster-xlog pgo show pvc a2-backup --pvc-root=a2-backups/2019-01-12-17-09-42`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 && !AllFlag { fmt.Println("Error: PVC name(s) or --all required for this command.") } else { if Namespace == "" { Namespace = PGONamespace } showPVC(args, Namespace) } }, }
var ShowPolicyCmd = &cobra.Command{ Use: "policy", Short: "Show policy information", Long: `Show policy information. For example: pgo show policy --all pgo show policy policy1`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 && !AllFlag { fmt.Println("Error: Policy name(s) or --all required for this command.") } else { if Namespace == "" { Namespace = PGONamespace } showPolicy(args, Namespace) } }, }
var ShowScheduleCmd = &cobra.Command{ Use: "schedule", Short: "Show schedule information", Long: `Show cron-like schedules. For example: pgo show schedule mycluster pgo show schedule --selector=pg-cluster=mycluster pgo show schedule --schedule-name=mycluster-pgbackrest-full`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } if len(args) == 0 && Selector == "" && ScheduleName == "" { fmt.Println("Error: cluster name, schedule name or selector is required to show a schedule.") return } showSchedule(args, Namespace) }, }
ShowScheduleCmd represents the show schedule command
var ShowUserCmd = &cobra.Command{ Use: "user", Short: "Show user information", Long: `Show users on a cluster. For example: pgo show user mycluster`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } if Selector == "" && len(args) == 0 { fmt.Println("Error: Cluster name(s) required for this command.") } else { showUser(args, Namespace) } }, }
ShowUserCmd represents the show user command
var ShowWorkflowCmd = &cobra.Command{ Use: "workflow", Short: "Show workflow information", Long: `Show workflow information for a given workflow. For example: pgo show workflow 25927091-b343-4017-be4b-71575f0b3eb5`, Run: func(cmd *cobra.Command, args []string) { if Namespace == "" { Namespace = PGONamespace } showWorkflow(args, Namespace) }, }
var Summary bool
var Target string
var UpdatePasswords bool
UpdatePasswords update passwords flag
var UserDBAccess string
UserDBAccess user db access flag
var UserLabels string
var ValidDays string
ValidDays valid days flag
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func GetCredentials ¶
func GetCredentials()
func GetCredentialsFromEnvironment ¶
func GetCredentialsFromEnvironment() msgs.BasicAuthCredentials
func GetCredentialsFromFile ¶
func GetCredentialsFromFile() msgs.BasicAuthCredentials
func UserHomeDir ¶
func UserHomeDir() string
Types ¶
This section is empty.
Source Files ¶
- auth.go
- backrest.go
- backup.go
- benchmark.go
- cat.go
- cluster.go
- config.go
- create.go
- delete.go
- df.go
- failover.go
- flags.go
- label.go
- load.go
- ls.go
- namespace.go
- pgbouncer.go
- pgdump.go
- pgpool.go
- policy.go
- pvc.go
- reload.go
- restore.go
- root.go
- scale.go
- scaledown.go
- schedule.go
- show.go
- status.go
- test.go
- update.go
- upgrade.go
- user.go
- version.go
- workflow.go