Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename DatabaseSnapshot to Snapshot #24

Merged
merged 1 commit into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/kubedb/describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ description of a given resource or group of resources.Valid resource types inclu
* all
* elastic
* postgres
* databasesnapshot
* snapshot
* deleteddatabase

Examples:
Expand Down
6 changes: 3 additions & 3 deletions docs/kubedb/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Valid resource types include:
* all
* elastic
* postgres
* databasesnapshot
* snapshot
* deleteddatabase

Examples:
Expand All @@ -27,8 +27,8 @@ Examples:
# List a single postgres with specified NAME in ps output format.
kubedb get postgres database

# List a single databasesnapshot in JSON output format.
kubedb get -o json databasesnapshot snapshot-xyz
# List a single snapshot in JSON output format.
kubedb get -o json snapshot snapshot-xyz

# List all postgreses and elastics together in ps output format.
kubedb get postgreses,elastics
Expand Down
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/cmd/decoder/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func Decode(kind string, data []byte) (runtime.Object, error) {
}
return postgres, nil

case tapi.ResourceKindDatabaseSnapshot:
var dbSnapshot *tapi.DatabaseSnapshot
if err := yaml.Unmarshal(data, &dbSnapshot); err != nil {
case tapi.ResourceKindSnapshot:
var snapshot *tapi.Snapshot
if err := yaml.Unmarshal(data, &snapshot); err != nil {
return nil, err
}
return dbSnapshot, nil
return snapshot, nil
case tapi.ResourceKindDeletedDatabase:
var deletedDb *tapi.DeletedDatabase
if err := yaml.Unmarshal(data, &deletedDb); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/describer/describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func newHumanReadableDescriber(f cmdutil.Factory) *humanReadableDescriber {
func (h *humanReadableDescriber) addDefaultHandlers() {
h.Handler(h.describeElastic)
h.Handler(h.describePostgres)
h.Handler(h.describeDatabaseSnapshot)
h.Handler(h.describeSnapshot)
h.Handler(h.describeDeletedDatabase)
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/describer/k8sdb_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (d *humanReadableDescriber) describeElastic(item *tapi.Elastic, describerSe
return "", err
}

snapshots, err := d.extensionsClient.DatabaseSnapshots(item.Namespace).List(
snapshots, err := d.extensionsClient.Snapshots(item.Namespace).List(
kapi.ListOptions{
LabelSelector: labels.SelectorFromSet(
map[string]string{
Expand Down Expand Up @@ -89,7 +89,7 @@ func (d *humanReadableDescriber) describePostgres(item *tapi.Postgres, describer
return "", err
}

snapshots, err := d.extensionsClient.DatabaseSnapshots(item.Namespace).List(
snapshots, err := d.extensionsClient.Snapshots(item.Namespace).List(
kapi.ListOptions{
LabelSelector: labels.SelectorFromSet(
map[string]string{
Expand Down Expand Up @@ -151,7 +151,7 @@ func (d *humanReadableDescriber) describePostgres(item *tapi.Postgres, describer
})
}

func (d *humanReadableDescriber) describeDatabaseSnapshot(item *tapi.DatabaseSnapshot, describerSettings *kubectl.DescriberSettings) (string, error) {
func (d *humanReadableDescriber) describeSnapshot(item *tapi.Snapshot, describerSettings *kubectl.DescriberSettings) (string, error) {
clientSet, err := d.ClientSet()
if err != nil {
return "", err
Expand Down Expand Up @@ -263,7 +263,7 @@ func describeStorage(storage *tapi.StorageSpec, out io.Writer) {
fmt.Fprintf(out, " Access Modes:\t%s\n", accessModes)
}

func listSnapshots(snapshotList *tapi.DatabaseSnapshotList, out io.Writer) {
func listSnapshots(snapshotList *tapi.SnapshotList, out io.Writer) {
fmt.Fprint(out, "\n")

if len(snapshotList.Items) == 0 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ var (
# List a single postgres with specified NAME in ps output format.
kubedb get postgres database

# List a single databasesnapshot in JSON output format.
kubedb get -o json databasesnapshot snapshot-xyz
# List a single snapshot in JSON output format.
kubedb get -o json snapshot snapshot-xyz

# List all postgreses and elastics together in ps output format.
kubedb get postgreses,elastics
Expand Down Expand Up @@ -68,7 +68,7 @@ const (
* all
* elastic
* postgres
* databasesnapshot
* snapshot
* deleteddatabase
`
)
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/printer/resource_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func (h *HumanReadablePrinter) addDefaultHandlers() {
h.Handler(h.printElastic)
h.Handler(h.printPostgresList)
h.Handler(h.printPostgres)
h.Handler(h.printDatabaseSnapshotList)
h.Handler(h.printDatabaseSnapshot)
h.Handler(h.printSnapshotList)
h.Handler(h.printSnapshot)
h.Handler(h.printDeletedDatabaseList)
h.Handler(h.printDeletedDatabase)
}
Expand Down Expand Up @@ -226,7 +226,7 @@ func (h *HumanReadablePrinter) printPostgresList(itemList *tapi.PostgresList, w
return nil
}

func (h *HumanReadablePrinter) printDatabaseSnapshot(item *tapi.DatabaseSnapshot, w io.Writer, options PrintOptions) error {
func (h *HumanReadablePrinter) printSnapshot(item *tapi.Snapshot, w io.Writer, options PrintOptions) error {
name := formatResourceName(options.Kind, item.Name, options.WithKind)

namespace := item.Namespace
Expand Down Expand Up @@ -260,9 +260,9 @@ func (h *HumanReadablePrinter) printDatabaseSnapshot(item *tapi.DatabaseSnapshot
return err
}

func (h *HumanReadablePrinter) printDatabaseSnapshotList(itemList *tapi.DatabaseSnapshotList, w io.Writer, options PrintOptions) error {
func (h *HumanReadablePrinter) printSnapshotList(itemList *tapi.SnapshotList, w io.Writer, options PrintOptions) error {
for _, item := range itemList.Items {
if err := h.printDatabaseSnapshot(&item, w, options); err != nil {
if err := h.printSnapshot(&item, w, options); err != nil {
return err
}
}
Expand Down Expand Up @@ -423,7 +423,7 @@ func formatWideHeaders(wide bool, t reflect.Type) []string {
if t.String() == "*api.Postgres" || t.String() == "*api.PostgresList" {
return []string{"VERSION"}
}
if t.String() == "*api.DatabaseSnapshot" || t.String() == "*api.DatabaseSnapshotList" {
if t.String() == "*api.Snapshot" || t.String() == "*api.SnapshotList" {
return []string{"BUCKET"}
}
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/cmd/util/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func GetSupportedResourceKind(resource string) (string, error) {
case strings.ToLower(tapi.ResourceTypePostgres):
case strings.ToLower(tapi.ResourceCodePostgres):
return tapi.ResourceKindPostgres, nil
case strings.ToLower(tapi.ResourceKindDatabaseSnapshot):
case strings.ToLower(tapi.ResourceTypeDatabaseSnapshot):
case strings.ToLower(tapi.ResourceCodeDatabaseSnapshot):
return tapi.ResourceKindDatabaseSnapshot, nil
case strings.ToLower(tapi.ResourceKindSnapshot):
case strings.ToLower(tapi.ResourceTypeSnapshot):
case strings.ToLower(tapi.ResourceCodeSnapshot):
return tapi.ResourceKindSnapshot, nil
case strings.ToLower(tapi.ResourceKindDeletedDatabase):
case strings.ToLower(tapi.ResourceTypeDeletedDatabase):
case strings.ToLower(tapi.ResourceCodeDeletedDatabase):
Expand All @@ -37,7 +37,7 @@ func CheckSupportedResource(kind string) error {
switch kind {
case tapi.ResourceKindElastic:
case tapi.ResourceKindPostgres:
case tapi.ResourceKindDatabaseSnapshot:
case tapi.ResourceKindSnapshot:
case tapi.ResourceKindDeletedDatabase:
return nil
default:
Expand All @@ -51,7 +51,7 @@ func GetAllSupportedResources(f cmdutil.Factory) ([]string, error) {
resources := map[string]string{
tapi.ResourceNameElastic: tapi.ResourceTypeElastic,
tapi.ResourceNamePostgres: tapi.ResourceTypePostgres,
tapi.ResourceNameDatabaseSnapshot: tapi.ResourceTypeDatabaseSnapshot,
tapi.ResourceNameSnapshot: tapi.ResourceTypeSnapshot,
tapi.ResourceNameDeletedDatabase: tapi.ResourceTypeDeletedDatabase,
}

Expand All @@ -78,7 +78,7 @@ func GetAllSupportedResources(f cmdutil.Factory) ([]string, error) {
var ShortForms = map[string]string{
tapi.ResourceCodeElastic: tapi.ResourceTypeElastic,
tapi.ResourceCodePostgres: tapi.ResourceTypePostgres,
tapi.ResourceCodeDatabaseSnapshot: tapi.ResourceTypeDatabaseSnapshot,
tapi.ResourceCodeSnapshot: tapi.ResourceTypeSnapshot,
tapi.ResourceCodeDeletedDatabase: tapi.ResourceTypeDeletedDatabase,
}

Expand Down
10 changes: 5 additions & 5 deletions vendor/github.com/k8sdb/apimachinery/api/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/github.com/k8sdb/apimachinery/api/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading