mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 06:15:40 +00:00
Merge pull request #81 from ncdc/verb-noun
Add verb-noun command aliases
This commit is contained in:
@@ -5,10 +5,13 @@ Back up and restore Kubernetes cluster resources.
|
||||
### Synopsis
|
||||
|
||||
|
||||
Heptio Ark is a tool for managing disaster recovery, specifically for
|
||||
Kubernetes cluster resources. It provides a simple, configurable,
|
||||
and operationally robust way to back up your application state and
|
||||
associated data.
|
||||
Heptio Ark is a tool for managing disaster recovery, specifically for Kubernetes
|
||||
cluster resources. It provides a simple, configurable, and operationally robust
|
||||
way to back up your application state and associated data.
|
||||
|
||||
If you're familiar with kubectl, Ark supports a similar model, allowing you to
|
||||
execute commands such as 'ark get backup' and 'ark create schedule'. The same
|
||||
operations can also be performed as 'ark backup get' and 'ark schedule create'.
|
||||
|
||||
### Options
|
||||
|
||||
@@ -26,6 +29,8 @@ associated data.
|
||||
|
||||
### SEE ALSO
|
||||
* [ark backup](ark_backup.md) - Work with backups
|
||||
* [ark create](ark_create.md) - Create ark resources
|
||||
* [ark get](ark_get.md) - Get ark resources
|
||||
* [ark restore](ark_restore.md) - Work with restores
|
||||
* [ark schedule](ark_schedule.md) - Work with schedules
|
||||
* [ark server](ark_server.md) - Run the ark server
|
||||
|
||||
34
docs/cli-reference/ark_create.md
Normal file
34
docs/cli-reference/ark_create.md
Normal file
@@ -0,0 +1,34 @@
|
||||
## ark create
|
||||
|
||||
Create ark resources
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Create ark resources
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for create
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark](ark.md) - Back up and restore Kubernetes cluster resources.
|
||||
* [ark create backup](ark_create_backup.md) - Create a backup
|
||||
* [ark create restore](ark_create_restore.md) - Create a restore
|
||||
* [ark create schedule](ark_create_schedule.md) - Create a schedule
|
||||
|
||||
47
docs/cli-reference/ark_create_backup.md
Normal file
47
docs/cli-reference/ark_create_backup.md
Normal file
@@ -0,0 +1,47 @@
|
||||
## ark create backup
|
||||
|
||||
Create a backup
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Create a backup
|
||||
|
||||
```
|
||||
ark create backup NAME [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--exclude-namespaces stringArray namespaces to exclude from the backup
|
||||
--exclude-resources stringArray resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io
|
||||
-h, --help help for backup
|
||||
--include-cluster-resources optionalBool[=true] include cluster-scoped resources in the backup
|
||||
--include-namespaces stringArray namespaces to include in the backup (use '*' for all namespaces) (default *)
|
||||
--include-resources stringArray resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources)
|
||||
--label-columns stringArray a comma-separated list of labels to be displayed as columns
|
||||
--labels mapStringString labels to apply to the backup
|
||||
-o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'.
|
||||
-l, --selector labelSelector only back up resources matching this label selector (default <none>)
|
||||
--show-labels show labels in the last column
|
||||
--snapshot-volumes optionalBool[=true] take snapshots of PersistentVolumes as part of the backup
|
||||
--ttl duration how long before the backup can be garbage collected (default 24h0m0s)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark create](ark_create.md) - Create ark resources
|
||||
|
||||
46
docs/cli-reference/ark_create_restore.md
Normal file
46
docs/cli-reference/ark_create_restore.md
Normal file
@@ -0,0 +1,46 @@
|
||||
## ark create restore
|
||||
|
||||
Create a restore
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Create a restore
|
||||
|
||||
```
|
||||
ark create restore BACKUP [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--exclude-namespaces stringArray namespaces to exclude from the restore
|
||||
--exclude-resources stringArray resources to exclude from the restore, formatted as resource.group, such as storageclasses.storage.k8s.io
|
||||
-h, --help help for restore
|
||||
--include-namespaces stringArray namespaces to include in the restore (use '*' for all namespaces) (default *)
|
||||
--include-resources stringArray resources to include in the restore, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources)
|
||||
--label-columns stringArray a comma-separated list of labels to be displayed as columns
|
||||
--labels mapStringString labels to apply to the restore
|
||||
--namespace-mappings mapStringString namespace mappings from name in the backup to desired restored name in the form src1:dst1,src2:dst2,...
|
||||
-o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'.
|
||||
--restore-volumes optionalBool[=true] whether to restore volumes from snapshots
|
||||
-l, --selector labelSelector only restore resources matching this label selector (default <none>)
|
||||
--show-labels show labels in the last column
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark create](ark_create.md) - Create ark resources
|
||||
|
||||
48
docs/cli-reference/ark_create_schedule.md
Normal file
48
docs/cli-reference/ark_create_schedule.md
Normal file
@@ -0,0 +1,48 @@
|
||||
## ark create schedule
|
||||
|
||||
Create a schedule
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Create a schedule
|
||||
|
||||
```
|
||||
ark create schedule NAME [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
--exclude-namespaces stringArray namespaces to exclude from the backup
|
||||
--exclude-resources stringArray resources to exclude from the backup, formatted as resource.group, such as storageclasses.storage.k8s.io
|
||||
-h, --help help for schedule
|
||||
--include-cluster-resources optionalBool[=true] include cluster-scoped resources in the backup
|
||||
--include-namespaces stringArray namespaces to include in the backup (use '*' for all namespaces) (default *)
|
||||
--include-resources stringArray resources to include in the backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use '*' for all resources)
|
||||
--label-columns stringArray a comma-separated list of labels to be displayed as columns
|
||||
--labels mapStringString labels to apply to the backup
|
||||
-o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'.
|
||||
--schedule string a cron expression specifying a recurring schedule for this backup to run
|
||||
-l, --selector labelSelector only back up resources matching this label selector (default <none>)
|
||||
--show-labels show labels in the last column
|
||||
--snapshot-volumes optionalBool[=true] take snapshots of PersistentVolumes as part of the backup
|
||||
--ttl duration how long before the backup can be garbage collected (default 24h0m0s)
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark create](ark_create.md) - Create ark resources
|
||||
|
||||
34
docs/cli-reference/ark_get.md
Normal file
34
docs/cli-reference/ark_get.md
Normal file
@@ -0,0 +1,34 @@
|
||||
## ark get
|
||||
|
||||
Get ark resources
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Get ark resources
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for get
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark](ark.md) - Back up and restore Kubernetes cluster resources.
|
||||
* [ark get backups](ark_get_backups.md) - Get backups
|
||||
* [ark get restores](ark_get_restores.md) - Get restores
|
||||
* [ark get schedules](ark_get_schedules.md) - Get schedules
|
||||
|
||||
39
docs/cli-reference/ark_get_backups.md
Normal file
39
docs/cli-reference/ark_get_backups.md
Normal file
@@ -0,0 +1,39 @@
|
||||
## ark get backups
|
||||
|
||||
Get backups
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Get backups
|
||||
|
||||
```
|
||||
ark get backups [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for backups
|
||||
--label-columns stringArray a comma-separated list of labels to be displayed as columns
|
||||
-o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. (default "table")
|
||||
-l, --selector string only show items matching this label selector
|
||||
--show-labels show labels in the last column
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark get](ark_get.md) - Get ark resources
|
||||
|
||||
39
docs/cli-reference/ark_get_restores.md
Normal file
39
docs/cli-reference/ark_get_restores.md
Normal file
@@ -0,0 +1,39 @@
|
||||
## ark get restores
|
||||
|
||||
Get restores
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Get restores
|
||||
|
||||
```
|
||||
ark get restores [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for restores
|
||||
--label-columns stringArray a comma-separated list of labels to be displayed as columns
|
||||
-o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. (default "table")
|
||||
-l, --selector string only show items matching this label selector
|
||||
--show-labels show labels in the last column
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark get](ark_get.md) - Get ark resources
|
||||
|
||||
39
docs/cli-reference/ark_get_schedules.md
Normal file
39
docs/cli-reference/ark_get_schedules.md
Normal file
@@ -0,0 +1,39 @@
|
||||
## ark get schedules
|
||||
|
||||
Get schedules
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Get schedules
|
||||
|
||||
```
|
||||
ark get schedules [flags]
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for schedules
|
||||
--label-columns stringArray a comma-separated list of labels to be displayed as columns
|
||||
-o, --output string Output display format. For create commands, display the object but do not send it to the server. Valid formats are 'table', 'json', and 'yaml'. (default "table")
|
||||
-l, --selector string only show items matching this label selector
|
||||
--show-labels show labels in the last column
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--alsologtostderr log to standard error as well as files
|
||||
--kubeconfig string Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
|
||||
--log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0)
|
||||
--log_dir string If non-empty, write log files in this directory
|
||||
--logtostderr log to standard error instead of files
|
||||
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
|
||||
-v, --v Level log level for V logs
|
||||
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [ark get](ark_get.md) - Get ark resources
|
||||
|
||||
@@ -30,6 +30,6 @@ Work with restores
|
||||
* [ark](ark.md) - Back up and restore Kubernetes cluster resources.
|
||||
* [ark restore create](ark_restore_create.md) - Create a restore
|
||||
* [ark restore delete](ark_restore_delete.md) - Delete a restore
|
||||
* [ark restore get](ark_restore_get.md) - get restores
|
||||
* [ark restore get](ark_restore_get.md) - Get restores
|
||||
* [ark restore logs](ark_restore_logs.md) - Get restore logs
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
## ark restore get
|
||||
|
||||
get restores
|
||||
Get restores
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
get restores
|
||||
Get restores
|
||||
|
||||
```
|
||||
ark restore get [flags]
|
||||
|
||||
@@ -23,6 +23,8 @@ import (
|
||||
|
||||
"github.com/heptio/ark/pkg/client"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/backup"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/create"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/get"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/restore"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/schedule"
|
||||
"github.com/heptio/ark/pkg/cmd/server"
|
||||
@@ -33,10 +35,13 @@ func NewCommand(name string) *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: name,
|
||||
Short: "Back up and restore Kubernetes cluster resources.",
|
||||
Long: `Heptio Ark is a tool for managing disaster recovery, specifically for
|
||||
Kubernetes cluster resources. It provides a simple, configurable,
|
||||
and operationally robust way to back up your application state and
|
||||
associated data.`,
|
||||
Long: `Heptio Ark is a tool for managing disaster recovery, specifically for Kubernetes
|
||||
cluster resources. It provides a simple, configurable, and operationally robust
|
||||
way to back up your application state and associated data.
|
||||
|
||||
If you're familiar with kubectl, Ark supports a similar model, allowing you to
|
||||
execute commands such as 'ark get backup' and 'ark create schedule'. The same
|
||||
operations can also be performed as 'ark backup get' and 'ark schedule create'.`,
|
||||
}
|
||||
|
||||
f := client.NewFactory(name)
|
||||
@@ -48,6 +53,8 @@ associated data.`,
|
||||
restore.NewCommand(f),
|
||||
server.NewCommand(),
|
||||
version.NewCommand(),
|
||||
get.NewCommand(f),
|
||||
create.NewCommand(f),
|
||||
)
|
||||
|
||||
// add the glog flags
|
||||
|
||||
@@ -30,8 +30,8 @@ func NewCommand(f client.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
c.AddCommand(
|
||||
NewCreateCommand(f),
|
||||
NewGetCommand(f),
|
||||
NewCreateCommand(f, "create"),
|
||||
NewGetCommand(f, "get"),
|
||||
NewLogsCommand(f),
|
||||
NewDownloadCommand(f),
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ import (
|
||||
"github.com/heptio/ark/pkg/cmd/util/output"
|
||||
)
|
||||
|
||||
func NewCreateCommand(f client.Factory) *cobra.Command {
|
||||
func NewCreateCommand(f client.Factory, use string) *cobra.Command {
|
||||
o := NewCreateOptions()
|
||||
|
||||
c := &cobra.Command{
|
||||
Use: "create NAME",
|
||||
Use: use + " NAME",
|
||||
Short: "Create a backup",
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
cmd.CheckError(o.Validate(c, args))
|
||||
|
||||
@@ -27,11 +27,11 @@ import (
|
||||
"github.com/heptio/ark/pkg/cmd/util/output"
|
||||
)
|
||||
|
||||
func NewGetCommand(f client.Factory) *cobra.Command {
|
||||
func NewGetCommand(f client.Factory, use string) *cobra.Command {
|
||||
var listOptions metav1.ListOptions
|
||||
|
||||
c := &cobra.Command{
|
||||
Use: "get",
|
||||
Use: use,
|
||||
Short: "Get backups",
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
err := output.ValidateFlags(c)
|
||||
|
||||
42
pkg/cmd/cli/create/create.go
Normal file
42
pkg/cmd/cli/create/create.go
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright 2017 Heptio Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package create
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/heptio/ark/pkg/client"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/backup"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/restore"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/schedule"
|
||||
)
|
||||
|
||||
func NewCommand(f client.Factory) *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "create",
|
||||
Short: "Create ark resources",
|
||||
Long: "Create ark resources",
|
||||
}
|
||||
|
||||
c.AddCommand(
|
||||
backup.NewCreateCommand(f, "backup"),
|
||||
schedule.NewCreateCommand(f, "schedule"),
|
||||
restore.NewCreateCommand(f, "restore"),
|
||||
)
|
||||
|
||||
return c
|
||||
}
|
||||
51
pkg/cmd/cli/get/get.go
Normal file
51
pkg/cmd/cli/get/get.go
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright 2017 Heptio Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package get
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/heptio/ark/pkg/client"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/backup"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/restore"
|
||||
"github.com/heptio/ark/pkg/cmd/cli/schedule"
|
||||
)
|
||||
|
||||
func NewCommand(f client.Factory) *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "get",
|
||||
Short: "Get ark resources",
|
||||
Long: "Get ark resources",
|
||||
}
|
||||
|
||||
backupCommand := backup.NewGetCommand(f, "backups")
|
||||
backupCommand.Aliases = []string{"backup"}
|
||||
|
||||
scheduleCommand := schedule.NewGetCommand(f, "schedules")
|
||||
scheduleCommand.Aliases = []string{"schedule"}
|
||||
|
||||
restoreCommand := restore.NewGetCommand(f, "restores")
|
||||
restoreCommand.Aliases = []string{"restore"}
|
||||
|
||||
c.AddCommand(
|
||||
backupCommand,
|
||||
scheduleCommand,
|
||||
restoreCommand,
|
||||
)
|
||||
|
||||
return c
|
||||
}
|
||||
@@ -33,11 +33,11 @@ import (
|
||||
"github.com/heptio/ark/pkg/cmd/util/output"
|
||||
)
|
||||
|
||||
func NewCreateCommand(f client.Factory) *cobra.Command {
|
||||
func NewCreateCommand(f client.Factory, use string) *cobra.Command {
|
||||
o := NewCreateOptions()
|
||||
|
||||
c := &cobra.Command{
|
||||
Use: "create BACKUP",
|
||||
Use: use + " BACKUP",
|
||||
Short: "Create a restore",
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
cmd.CheckError(o.Validate(c, args))
|
||||
|
||||
@@ -27,12 +27,12 @@ import (
|
||||
"github.com/heptio/ark/pkg/cmd/util/output"
|
||||
)
|
||||
|
||||
func NewGetCommand(f client.Factory) *cobra.Command {
|
||||
func NewGetCommand(f client.Factory, use string) *cobra.Command {
|
||||
var listOptions metav1.ListOptions
|
||||
|
||||
c := &cobra.Command{
|
||||
Use: "get",
|
||||
Short: "get restores",
|
||||
Use: use,
|
||||
Short: "Get restores",
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
err := output.ValidateFlags(c)
|
||||
cmd.CheckError(err)
|
||||
|
||||
@@ -30,8 +30,8 @@ func NewCommand(f client.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
c.AddCommand(
|
||||
NewCreateCommand(f),
|
||||
NewGetCommand(f),
|
||||
NewCreateCommand(f, "create"),
|
||||
NewGetCommand(f, "get"),
|
||||
NewLogsCommand(f),
|
||||
// Will implement later
|
||||
// NewDescribeCommand(f),
|
||||
|
||||
@@ -32,11 +32,11 @@ import (
|
||||
"github.com/heptio/ark/pkg/cmd/util/output"
|
||||
)
|
||||
|
||||
func NewCreateCommand(f client.Factory) *cobra.Command {
|
||||
func NewCreateCommand(f client.Factory, use string) *cobra.Command {
|
||||
o := NewCreateOptions()
|
||||
|
||||
c := &cobra.Command{
|
||||
Use: "create NAME",
|
||||
Use: use + " NAME",
|
||||
Short: "Create a schedule",
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
cmd.CheckError(o.Validate(c, args))
|
||||
|
||||
@@ -27,11 +27,11 @@ import (
|
||||
"github.com/heptio/ark/pkg/cmd/util/output"
|
||||
)
|
||||
|
||||
func NewGetCommand(f client.Factory) *cobra.Command {
|
||||
func NewGetCommand(f client.Factory, use string) *cobra.Command {
|
||||
var listOptions metav1.ListOptions
|
||||
|
||||
c := &cobra.Command{
|
||||
Use: "get",
|
||||
Use: use,
|
||||
Short: "Get schedules",
|
||||
Run: func(c *cobra.Command, args []string) {
|
||||
err := output.ValidateFlags(c)
|
||||
|
||||
@@ -30,8 +30,8 @@ func NewCommand(f client.Factory) *cobra.Command {
|
||||
}
|
||||
|
||||
c.AddCommand(
|
||||
NewCreateCommand(f),
|
||||
NewGetCommand(f),
|
||||
NewCreateCommand(f, "create"),
|
||||
NewGetCommand(f, "get"),
|
||||
// Will implement later
|
||||
// NewDescribeCommand(f),
|
||||
NewDeleteCommand(f),
|
||||
|
||||
Reference in New Issue
Block a user