forked from ovh/terraform-provider-ovh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource_iploadbalancing_udp_farm_gen.go
147 lines (121 loc) · 4.83 KB
/
resource_iploadbalancing_udp_farm_gen.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
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
package ovh
import (
"context"
ovhtypes "github.com/ovh/terraform-provider-ovh/ovh/types"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
)
func IploadbalancingUdpFarmResourceSchema(ctx context.Context) schema.Schema {
attrs := map[string]schema.Attribute{
"display_name": schema.StringAttribute{
CustomType: ovhtypes.TfStringType{},
Optional: true,
Description: "Human readable name for your backend, this field is for you",
MarkdownDescription: "Human readable name for your backend, this field is for you",
},
"farm_id": schema.Int64Attribute{
CustomType: ovhtypes.TfInt64Type{},
Computed: true,
Description: "Id of your farm",
MarkdownDescription: "Id of your farm",
},
"port": schema.Int64Attribute{
CustomType: ovhtypes.TfInt64Type{},
Required: true,
Description: "Port attached to your farm ([1..49151]). Inherited from frontend if null",
MarkdownDescription: "Port attached to your farm ([1..49151]). Inherited from frontend if null",
},
"service_name": schema.StringAttribute{
CustomType: ovhtypes.TfStringType{},
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "The internal name of your IP load balancing",
MarkdownDescription: "The internal name of your IP load balancing",
},
"vrack_network_id": schema.Int64Attribute{
CustomType: ovhtypes.TfInt64Type{},
Optional: true,
Description: "Internal Load Balancer identifier of the vRack private network to attach to your farm, mandatory when your Load Balancer is attached to a vRack",
MarkdownDescription: "Internal Load Balancer identifier of the vRack private network to attach to your farm, mandatory when your Load Balancer is attached to a vRack",
},
"zone": schema.StringAttribute{
CustomType: ovhtypes.TfStringType{},
Required: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Description: "Zone of your farm",
MarkdownDescription: "Zone of your farm",
},
}
return schema.Schema{
Attributes: attrs,
}
}
type IploadbalancingUdpFarmModel struct {
DisplayName ovhtypes.TfStringValue `tfsdk:"display_name" json:"displayName"`
FarmId ovhtypes.TfInt64Value `tfsdk:"farm_id" json:"farmId"`
Port ovhtypes.TfInt64Value `tfsdk:"port" json:"port"`
ServiceName ovhtypes.TfStringValue `tfsdk:"service_name" json:"serviceName"`
VrackNetworkId ovhtypes.TfInt64Value `tfsdk:"vrack_network_id" json:"vrackNetworkId"`
Zone ovhtypes.TfStringValue `tfsdk:"zone" json:"zone"`
}
func (v *IploadbalancingUdpFarmModel) MergeWith(other *IploadbalancingUdpFarmModel) {
if (v.DisplayName.IsUnknown() || v.DisplayName.IsNull()) && !other.DisplayName.IsUnknown() {
v.DisplayName = other.DisplayName
}
if (v.FarmId.IsUnknown() || v.FarmId.IsNull()) && !other.FarmId.IsUnknown() {
v.FarmId = other.FarmId
}
if (v.Port.IsUnknown() || v.Port.IsNull()) && !other.Port.IsUnknown() {
v.Port = other.Port
}
if (v.ServiceName.IsUnknown() || v.ServiceName.IsNull()) && !other.ServiceName.IsUnknown() {
v.ServiceName = other.ServiceName
}
if (v.VrackNetworkId.IsUnknown() || v.VrackNetworkId.IsNull()) && !other.VrackNetworkId.IsUnknown() {
v.VrackNetworkId = other.VrackNetworkId
}
if (v.Zone.IsUnknown() || v.Zone.IsNull()) && !other.Zone.IsUnknown() {
v.Zone = other.Zone
}
}
type IploadbalancingUdpFarmWritableModel struct {
DisplayName *ovhtypes.TfStringValue `tfsdk:"display_name" json:"displayName,omitempty"`
Port *ovhtypes.TfInt64Value `tfsdk:"port" json:"port,omitempty"`
VrackNetworkId *ovhtypes.TfInt64Value `tfsdk:"vrack_network_id" json:"vrackNetworkId,omitempty"`
Zone *ovhtypes.TfStringValue `tfsdk:"zone" json:"zone,omitempty"`
}
func (v IploadbalancingUdpFarmModel) ToCreate() *IploadbalancingUdpFarmWritableModel {
res := &IploadbalancingUdpFarmWritableModel{}
if !v.DisplayName.IsUnknown() {
res.DisplayName = &v.DisplayName
}
if !v.Port.IsUnknown() {
res.Port = &v.Port
}
if !v.VrackNetworkId.IsUnknown() {
res.VrackNetworkId = &v.VrackNetworkId
}
if !v.Zone.IsUnknown() {
res.Zone = &v.Zone
}
return res
}
func (v IploadbalancingUdpFarmModel) ToUpdate() *IploadbalancingUdpFarmWritableModel {
res := &IploadbalancingUdpFarmWritableModel{}
if !v.DisplayName.IsUnknown() {
res.DisplayName = &v.DisplayName
}
if !v.Port.IsUnknown() {
res.Port = &v.Port
}
if !v.VrackNetworkId.IsUnknown() {
res.VrackNetworkId = &v.VrackNetworkId
}
return res
}