/
database-skel.go
61 lines (50 loc) · 1.92 KB
/
database-skel.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package objects
import (
"encoding/json"
"fmt"
"github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
)
// DatabaseRequest - Cloud Manager Database Request
type DatabaseRequest struct {
AccountID string `json:"accountId"`
AuthorizationCode string `json:"authorizationCode"`
BackupFrequency string `json:"backupFrequency"`
BackupInterval int `json:"backupInterval"`
BackupKeepCount int `json:"backupKeepCount"`
BackupStartWindow string `json:"backupStartWindow"`
CloudProvider string `json:"cloudProvider"`
ClusterPowerOlap int `json:"clusterPowerOlap"`
ClusterPowerOltp int `json:"clusterPowerOltp"`
DedicatedStorage bool `json:"dedicatedStorage"`
ExternalDatasetSizeGb int `json:"externalDatasetSizeGb"`
InternalDatasetSizeGb int `json:"internalDatasetSizeGb"`
MlManager bool `json:"mlManager"`
Name string `json:"name"`
NotebookActiveUsers int `json:"notebookActiveUsers"`
NotebookExecutorsPerNotebook int `json:"notebookExecutorsPerNotebook"`
NotebookTotalUsers int `json:"notebookTotalUsers"`
NotebooksPerUser int `json:"notebooksPerUser"`
Password string `json:"password"`
// Region string `json:"region"`
}
// ToJSON - Write the output as JSON
func (r *DatabaseRequest) ToJSON() error {
rJSON, enverr := json.MarshalIndent(r, "", " ")
if enverr != nil {
logrus.WithError(enverr).Error("Error extracting json")
return enverr
}
fmt.Println(string(rJSON[:]))
return nil
}
// ToYAML - Write the output as YAML
func (r *DatabaseRequest) ToYAML() error {
rYAML, enverr := yaml.Marshal(r)
if enverr != nil {
logrus.WithError(enverr).Error("Error extracting yaml")
return enverr
}
fmt.Println(string(rYAML[:]))
return nil
}