-
Notifications
You must be signed in to change notification settings - Fork 132
/
types_ip_service.go
65 lines (51 loc) · 1.57 KB
/
types_ip_service.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
package ovh
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/ovh/terraform-provider-ovh/ovh/helpers"
)
type IpService struct {
CanBeTerminated bool `json:"canBeTerminated"`
Country *string `json:"country"`
Description *string `json:"description"`
Ip string `json:"ip"`
OrganisationId *string `json:"organisationId"`
RoutedTo *IpServiceRoutedTo `json:"routedTo"`
Type string `json:"type"`
}
func (v IpService) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["can_be_terminated"] = v.CanBeTerminated
obj["ip"] = v.Ip
obj["type"] = v.Type
if v.Country != nil {
obj["country"] = *v.Country
}
if v.Description != nil {
obj["description"] = *v.Description
}
if v.OrganisationId != nil {
obj["organisation_id"] = *v.OrganisationId
}
if v.RoutedTo != nil {
obj["routed_to"] = []interface{}{v.RoutedTo.ToMap()}
}
return obj
}
type IpServiceRoutedTo struct {
ServiceName string `json:"serviceName"`
}
func (v IpServiceRoutedTo) ToMap() map[string]interface{} {
obj := make(map[string]interface{})
obj["service_name"] = v.ServiceName
return obj
}
type IpServiceUpdateOpts struct {
Description *string `json:"description,omitempty"`
}
func (opts *IpServiceUpdateOpts) FromResource(d *schema.ResourceData) *IpServiceUpdateOpts {
opts.Description = helpers.GetNilStringPointerFromData(d, "description")
return opts
}
type IpServiceConfirmTerminationOpts struct {
Token string `json:"token"`
}