-
Notifications
You must be signed in to change notification settings - Fork 133
/
types_hostingPrivatedatabase.go
286 lines (239 loc) · 8.55 KB
/
types_hostingPrivatedatabase.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
package ovh
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/ovh/terraform-provider-ovh/ovh/helpers"
)
type HostingPrivateDatabase struct {
ServiceName string `json:"serviceName"`
Cpu int `json:"cpu"`
Datacenter string `json:"datacenter"`
DisplayName string `json:"displayName"`
Hostname string `json:"hostname"`
HostnameFtp string `json:"hostnameFtp"`
Infrastructure string `json:"infrastructure"`
Offer string `json:"offer"`
Port int `json:"port"`
PortFtp int `json:"portFtp"`
QuotaSize *UnitAndValue `json:"quotasize"`
QuotaUsed *UnitAndValue `json:"quotaUsed"`
Ram *UnitAndValue `json:"ram"`
Server string `json:"server"`
State string `json:"state"`
Type string `json:"type"`
Version string `json:"version"`
VersionLabel string `json:"versionLabel"`
VersionNumber float64 `json:"versionNumber"`
}
func (v HostingPrivateDatabase) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["service_name"] = v.ServiceName
obj["cpu"] = v.Cpu
obj["datacenter"] = v.Datacenter
obj["display_name"] = v.DisplayName
obj["hostname"] = v.Hostname
obj["hostname_ftp"] = v.HostnameFtp
obj["infrastructure"] = v.Infrastructure
obj["offer"] = v.Offer
obj["port"] = v.Port
obj["port_ftp"] = v.PortFtp
obj["quota_size"] = v.QuotaSize.Value
obj["quota_used"] = v.QuotaUsed.Value
obj["ram"] = v.Ram.Value
obj["state"] = v.State
obj["type"] = v.Type
obj["version"] = v.Version
obj["version_label"] = v.VersionLabel
obj["version_number"] = v.VersionNumber
return obj
}
type HostingPrivateDatabaseOpts struct {
DisplayName *string `json:"displayName"`
}
func (opts *HostingPrivateDatabaseOpts) FromResource(d *schema.ResourceData) *HostingPrivateDatabaseOpts {
opts.DisplayName = helpers.GetNilStringPointerFromData(d, "display_name")
return opts
}
type HostingPrivateDatabaseConfirmTerminationOpts struct {
Token string `json:"token"`
}
type DataSourceHostingPrivateDatabaseDatabase struct {
BackupTime string `json:"backupTime"`
QuotaUsed *UnitAndValue `json:"quotaUsed"`
CreationDate string `json:"creationDate"`
Users []*DataSourceHostingPrivateDatabaseDatabaseUsers `json:"users"`
}
func (v DataSourceHostingPrivateDatabaseDatabase) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["backup_time"] = v.BackupTime
obj["quota_used"] = v.QuotaUsed.Value
obj["creation_date"] = v.CreationDate
var users []map[string]interface{}
for _, r := range v.Users {
users = append(users, r.ToMap())
}
obj["users"] = users
return obj
}
type DataSourceHostingPrivateDatabaseDatabaseUsers struct {
UserName string `json:"userName"`
GrantType string `json:"grantType"`
}
func (v DataSourceHostingPrivateDatabaseDatabaseUsers) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["user_name"] = v.UserName
obj["grant_type"] = v.GrantType
return obj
}
type HostingPrivateDatabaseDatabase struct {
DoneDate string `json:"doneDate"`
LastUpdate string `json:"lastUpdate"`
UserName string `json:"userName"`
DumpId string `json:"dumpId"`
DatabaseName string `json:"databaseName"`
TaskId int `json:"id"`
StartDate string `json:"startDate"`
Status string `json:"status"`
}
func (v HostingPrivateDatabaseDatabase) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["database_name"] = v.DatabaseName
return obj
}
type HostingPrivateDatabaseDatabaseCreateOpts struct {
DatabaseName string `json:"databaseName"`
}
func (opts *HostingPrivateDatabaseDatabaseCreateOpts) FromResource(d *schema.ResourceData) *HostingPrivateDatabaseDatabaseCreateOpts {
opts.DatabaseName = d.Get("database_name").(string)
return opts
}
type DataSourceHostingPrivateDatabaseUser struct {
CreationDate string `json:"creationDate"`
Databases []*DataSourceHostingPrivateDatabaseUserDatabases `json:"databases"`
}
func (v DataSourceHostingPrivateDatabaseUser) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["creation_date"] = v.CreationDate
var databases []map[string]interface{}
for _, r := range v.Databases {
databases = append(databases, r.ToMap())
}
obj["databases"] = databases
return obj
}
type DataSourceHostingPrivateDatabaseUserDatabases struct {
DatabaseName string `json:"databaseName"`
GrantType string `json:"grantType"`
}
func (v DataSourceHostingPrivateDatabaseUserDatabases) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["database_name"] = v.DatabaseName
obj["grant_type"] = v.GrantType
return obj
}
type HostingPrivateDatabaseUser struct {
LastUpdate string `json:"lastUpdate"`
DoneDate string `json:"doneDate"`
Status string `json:"status"`
StartDate string `json:"startDate"`
DatabaseName string `json:"databaseName"`
UserName string `json:"userName"`
TaskId int `json:"id"`
}
func (v HostingPrivateDatabaseUser) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["user_name"] = v.UserName
return obj
}
type HostingPrivateDatabaseUserCreateOpts struct {
Password string `json:"password"`
UserName string `json:"userName"`
}
func (opts *HostingPrivateDatabaseUserCreateOpts) FromResource(d *schema.ResourceData) *HostingPrivateDatabaseUserCreateOpts {
opts.Password = d.Get("password").(string)
opts.UserName = d.Get("user_name").(string)
return opts
}
type HostingPrivateDatabaseUserGrant struct {
LastUpdate string `json:"lastUpdate"`
DoneDate string `json:"doneDate"`
Status string `json:"status"`
StartDate string `json:"startDate"`
DatabaseName string `json:"databaseName"`
UserName string `json:"userName"`
TaskId int `json:"id"`
}
type HostingPrivateDatabaseUserGrantCreateOpts struct {
DatabaseName string `json:"databaseName"`
Grant string `json:"grant"`
}
func (opts *HostingPrivateDatabaseUserGrantCreateOpts) FromResource(d *schema.ResourceData) *HostingPrivateDatabaseUserGrantCreateOpts {
opts.DatabaseName = d.Get("database_name").(string)
opts.Grant = d.Get("grant").(string)
return opts
}
func (v HostingPrivateDatabaseUserGrantCreateOpts) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["grant"] = v.Grant
obj["database_name"] = v.DatabaseName
return obj
}
type DataSourceHostingPrivateDatabaseUserGrant struct {
CreationDate string `json:"creationDate"`
Grant string `json:"grant"`
}
func (v DataSourceHostingPrivateDatabaseUserGrant) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["creation_date"] = v.CreationDate
obj["grant"] = v.Grant
return obj
}
type HostingPrivateDatabaseWhitelist struct {
CreationDate string `json:"creationDate"`
LastUpdate string `json:"lastUpdate"`
Name string `json:"name"`
Service bool `json:"service"`
Sftp bool `json:"sftp"`
Status string `json:"status"`
TaskId int `json:"id"`
}
func (v HostingPrivateDatabaseWhitelist) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["name"] = v.Name
obj["service"] = v.Service
obj["sftp"] = v.Sftp
return obj
}
func (v HostingPrivateDatabaseWhitelist) DataSourceToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["name"] = v.Name
obj["service"] = v.Service
obj["sftp"] = v.Sftp
obj["creation_date"] = v.CreationDate
obj["last_update"] = v.LastUpdate
obj["status"] = v.Status
return obj
}
type HostingPrivateDatabaseWhitelistCreateOpts struct {
Ip string `json:"ip"`
Name string `json:"name"`
Service bool `json:"service"`
Sftp bool `json:"sftp"`
}
func (opts *HostingPrivateDatabaseWhitelistCreateOpts) FromResource(d *schema.ResourceData) *HostingPrivateDatabaseWhitelistCreateOpts {
opts.Ip = d.Get("ip").(string)
opts.Name = d.Get("name").(string)
opts.Service = d.Get("service").(bool)
opts.Sftp = d.Get("sftp").(bool)
return opts
}
type HostingPrivateDatabaseWhitelistUpdateOpts struct {
Name string `json:"name"`
Service bool `json:"service"`
Sftp bool `json:"sftp"`
}
func (opts *HostingPrivateDatabaseWhitelistUpdateOpts) FromResource(d *schema.ResourceData) *HostingPrivateDatabaseWhitelistUpdateOpts {
opts.Name = d.Get("name").(string)
opts.Service = d.Get("service").(bool)
opts.Sftp = d.Get("sftp").(bool)
return opts
}