cmd

package
v4.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

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

View Source
const CAPMAX = 50
View Source
const TreeBranch = "\t"
View Source
const TreeTrunk = "\t"

Variables

View Source
var (
	BenchmarkClients      int
	BenchmarkJobs         int
	BenchmarkScale        int
	BenchmarkTransactions int
	BenchmarkDatabase     string
	BenchmarkInitOpts     string
	BenchmarkOpts         string
	BenchmarkPolicy       string
	BenchmarkUser         string
)
View Source
var APIServerURL string
View Source
var AllFlag bool
View Source
var ArchiveFlag, AutofailFlag, PgpoolFlag, PgbouncerFlag, MetricsFlag, BadgerFlag bool
View Source
var AutofailReplaceReplica string
View Source
var AutofailStringFlag string
View Source
var BackrestFlag, BackrestRestoreFrom string
View Source
var BackrestStorageType string
View Source
var BackupOpts string
View Source
var BackupPath, BackupPVC string
View Source
var BackupType string
View Source
var CCPImage string
View Source
var CCPImageTag string
View Source
var ChangePasswordForUser string

ChangePasswordForUser change password flag

View Source
var ClusterReplicaCount int
View Source
var ConfigMapName string

unused but coming soon to a theatre near you

View Source
var ContainerResources string
View Source
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`)
		}
	},
}
View Source
var CustomConfig string
View Source
var DebugFlag bool
View Source
var DeleteBackups bool
View Source
var DeleteData bool

flags used by more than 1 command

View Source
var DeleteLabel bool
View Source
var DeleteUser string

DeleteUser delete user flag

View Source
var DryRun bool
View Source
var Expired string

Expired expired flag

View Source
var GREEN func(a ...interface{}) string
View Source
var LabelCmdLabel string
View Source
var LabelMap map[string]string
View Source
var Labelselector string
View Source
var LoadConfig string
View Source
var ManagedUser bool
View Source
var Namespace string
View Source
var NoPrompt bool
View Source
var NodeLabel string
View Source
var OutputFormat string
View Source
var PGBackRestType string
View Source
var PGONamespace string
View Source
var PGO_CA_CERT, PGO_CLIENT_CERT, PGO_CLIENT_KEY string
View Source
var PITRTarget, RestoreBackupPath string
View Source
var PVCName string
View Source
var PVCRoot string
View Source
var Password string
View Source
var PasswordAgeDays int

PasswordAgeDays password age flag

View Source
var PasswordLength int

PasswordLength password length flag

View Source
var PgBouncerPassword string
View Source
var PgBouncerUser string
View Source
var PgbouncerSecret string
View Source
var PgpoolSecret string
View Source
var PoliciesFlag, PolicyFile, PolicyURL string
View Source
var Query bool
View Source
var RED func(a ...interface{}) string
View Source
var ReplicaCount int
View Source
var ReplicaStorageConfig, StorageConfig string
View Source
var RestoreToPVC string
View Source
var RestoreType string
View Source
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

View Source
var Schedule string
View Source
var ScheduleDatabase string
View Source
var ScheduleName string
View Source
var ScheduleOptions string
View Source
var SchedulePolicy string
View Source
var ScheduleSecret string
View Source
var ScheduleType string
View Source
var Secret string
View Source
var SecretFrom string
View Source
var Selector string
View Source
var Series int
View Source
var ServiceType string
View Source
var SessionCredentials msgs.BasicAuthCredentials
View Source
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

View Source
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

View Source
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

View Source
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`)
			}
		}

	},
}
View Source
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)
	},
}
View Source
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)
	},
}
View Source
var ShowPVC bool
View Source
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)
		}
	},
}
View Source
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)
		}
	},
}
View Source
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

View Source
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

View Source
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)
	},
}
View Source
var Summary bool
View Source
var Target string
View Source
var UpdatePasswords bool

UpdatePasswords update passwords flag

View Source
var UserDBAccess string

UserDBAccess user db access flag

View Source
var UserLabels string
View Source
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 StatusCheck

func StatusCheck(resp *http.Response)

StatusCheck ...

func UserHomeDir

func UserHomeDir() string

Types

This section is empty.

Jump to

Keyboard shortcuts

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