Add omitempty tag to optional API fields

Signed-off-by: Nikhita Raghunath <nikitaraghunath@gmail.com>
pull/580/head
Nikhita Raghunath 2018-06-25 16:40:43 +05:30
parent 6426706390
commit 0da5f1ccca
2 changed files with 5 additions and 5 deletions

View File

@ -44,7 +44,7 @@ type BackupSpec struct {
// SnapshotVolumes specifies whether to take cloud snapshots
// of any PV's referenced in the set of objects included
// in the Backup.
SnapshotVolumes *bool `json:"snapshotVolumes"`
SnapshotVolumes *bool `json:"snapshotVolumes,omitempty"`
// TTL is a time.Duration-parseable string describing how long
// the Backup should be retained for.
@ -80,7 +80,7 @@ type BackupResourceHookSpec struct {
// ExcludedResources specifies the resources to which this hook spec does not apply.
ExcludedResources []string `json:"excludedResources"`
// LabelSelector, if specified, filters the resources to which this hook spec applies.
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
// Hooks is a list of BackupResourceHooks to execute. DEPRECATED. Replaced by PreHooks.
Hooks []BackupResourceHook `json:"hooks"`
// PreHooks is a list of BackupResourceHooks to execute prior to storing the item in the backup.

View File

@ -49,16 +49,16 @@ type RestoreSpec struct {
// LabelSelector is a metav1.LabelSelector to filter with
// when restoring individual objects from the backup. If empty
// or nil, all objects are included. Optional.
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
// RestorePVs specifies whether to restore all included
// PVs from snapshot (via the cloudprovider).
RestorePVs *bool `json:"restorePVs"`
RestorePVs *bool `json:"restorePVs,omitempty"`
// IncludeClusterResources specifies whether cluster-scoped resources
// should be included for consideration in the restore. If null, defaults
// to true.
IncludeClusterResources *bool `json:"includeClusterResources"`
IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
}
// RestorePhase is a string representation of the lifecycle phase