-
Notifications
You must be signed in to change notification settings - Fork 133
/
types_dbaas_logs.go
61 lines (54 loc) · 1.93 KB
/
types_dbaas_logs.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 ovh
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
type DbaasLogsInputEngine struct {
Id string `json:"engineId"`
IsDeprecated bool `json:"isDeprecated"`
Name string `json:"name"`
Version string `json:"version"`
}
func (v DbaasLogsInputEngine) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["id"] = v.Id
obj["is_deprecated"] = v.IsDeprecated
obj["name"] = v.Name
obj["version"] = v.Version
return obj
}
type DbaasLogsOperation struct {
AliasId *string `json:"aliasId"`
CreatedAt string `json:"createdAt"`
DashboardId *string `json:"dashboardId"`
IndexId *string `json:"indexId"`
InputId *string `json:"inputId"`
KibanaId *string `json:"kibanaId"`
OperationId string `json:"operationId"`
OsdId *string `json:"osdId"`
RoleId *string `json:"roleId"`
State string `json:"state"`
StreamId *string `json:"streamId"`
SubscriptionID *string `json:"subscriptionId"`
UpdatedAt string `json:"updatedAt"`
}
type DbaasLogsOpts struct {
ArchiveAllowedNetworks []string `json:"archiveAllowedNetworks"`
DirectInputAllowedNetworks []string `json:"directInputAllowedNetworks"`
QueryAllowedNetworks []string `json:"queryAllowedNetworks"`
}
func convertNetworks(networks []interface{}) []string {
if networks == nil {
return nil
}
networksString := make([]string, len(networks))
for i, net := range networks {
networksString[i] = net.(string)
}
return networksString
}
func (opts *DbaasLogsOpts) FromResource(d *schema.ResourceData) *DbaasLogsOpts {
opts.ArchiveAllowedNetworks = convertNetworks(d.Get("archive_allowed_networks").(*schema.Set).List())
opts.DirectInputAllowedNetworks = convertNetworks(d.Get("direct_input_allowed_networks").(*schema.Set).List())
opts.QueryAllowedNetworks = convertNetworks(d.Get("query_allowed_networks").(*schema.Set).List())
return opts
}