forked from ovh/terraform-provider-ovh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresource_iploadbalancing_udp_frontend_gen.go
186 lines (154 loc) · 6.88 KB
/
resource_iploadbalancing_udp_frontend_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
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
// 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 IploadbalancingUdpFrontendResourceSchema(ctx context.Context) schema.Schema {
return schema.Schema{
Attributes: map[string]schema.Attribute{
"dedicated_ipfo": schema.ListAttribute{
CustomType: ovhtypes.NewTfListNestedType[ovhtypes.TfStringValue](ctx),
Optional: true,
Description: "Only attach frontend on these ip. No restriction if null",
MarkdownDescription: "Only attach frontend on these ip. No restriction if null",
},
"default_farm_id": schema.Int64Attribute{
CustomType: ovhtypes.TfInt64Type{},
Optional: true,
Description: "Default UDP Farm of your frontend",
MarkdownDescription: "Default UDP Farm of your frontend",
},
"disabled": schema.BoolAttribute{
CustomType: ovhtypes.TfBoolType{},
Optional: true,
Description: "Disable your frontend. Default: 'false'",
MarkdownDescription: "Disable your frontend. Default: 'false'",
},
"display_name": schema.StringAttribute{
CustomType: ovhtypes.TfStringType{},
Optional: true,
Description: "Human readable name for your frontend, this field is for you",
MarkdownDescription: "Human readable name for your frontend, this field is for you",
},
"frontend_id": schema.Int64Attribute{
CustomType: ovhtypes.TfInt64Type{},
Computed: true,
Description: "Id of your frontend",
MarkdownDescription: "Id of your frontend",
},
"port": schema.StringAttribute{
CustomType: ovhtypes.TfStringType{},
Required: true,
Description: "Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range.",
MarkdownDescription: "Port(s) attached to your frontend. Supports single port (numerical value), range (2 dash-delimited increasing ports) and comma-separated list of 'single port' and/or 'range'. Each port must be in the [1;49151] range.",
},
"service_name": schema.StringAttribute{
CustomType: ovhtypes.TfStringType{},
Required: true,
Description: "The internal name of your IP load balancing",
MarkdownDescription: "The internal name of your IP load balancing",
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
},
"zone": schema.StringAttribute{
CustomType: ovhtypes.TfStringType{},
Required: true,
Description: "Zone of your frontend. Use \"all\" for all owned zone.",
MarkdownDescription: "Zone of your frontend. Use \"all\" for all owned zone.",
},
},
}
}
type IploadbalancingUdpFrontendModel struct {
DedicatedIpfo ovhtypes.TfListNestedValue[ovhtypes.TfStringValue] `tfsdk:"dedicated_ipfo" json:"dedicatedIpfo"`
DefaultFarmId ovhtypes.TfInt64Value `tfsdk:"default_farm_id" json:"defaultFarmId"`
Disabled ovhtypes.TfBoolValue `tfsdk:"disabled" json:"disabled"`
DisplayName ovhtypes.TfStringValue `tfsdk:"display_name" json:"displayName"`
FrontendId ovhtypes.TfInt64Value `tfsdk:"frontend_id" json:"frontendId"`
Port ovhtypes.TfStringValue `tfsdk:"port" json:"port"`
ServiceName ovhtypes.TfStringValue `tfsdk:"service_name" json:"serviceName"`
Zone ovhtypes.TfStringValue `tfsdk:"zone" json:"zone"`
}
func (v *IploadbalancingUdpFrontendModel) MergeWith(other *IploadbalancingUdpFrontendModel) {
if (v.DedicatedIpfo.IsUnknown() || v.DedicatedIpfo.IsNull()) && !other.DedicatedIpfo.IsUnknown() {
v.DedicatedIpfo = other.DedicatedIpfo
}
if (v.DefaultFarmId.IsUnknown() || v.DefaultFarmId.IsNull()) && !other.DefaultFarmId.IsUnknown() {
v.DefaultFarmId = other.DefaultFarmId
}
if (v.Disabled.IsUnknown() || v.Disabled.IsNull()) && !other.Disabled.IsUnknown() {
v.Disabled = other.Disabled
}
if (v.DisplayName.IsUnknown() || v.DisplayName.IsNull()) && !other.DisplayName.IsUnknown() {
v.DisplayName = other.DisplayName
}
if (v.FrontendId.IsUnknown() || v.FrontendId.IsNull()) && !other.FrontendId.IsUnknown() {
v.FrontendId = other.FrontendId
}
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.Zone.IsUnknown() || v.Zone.IsNull()) && !other.Zone.IsUnknown() {
v.Zone = other.Zone
}
}
type IploadbalancingUdpFrontendWritableModel struct {
DedicatedIpfo *ovhtypes.TfListNestedValue[ovhtypes.TfStringValue] `tfsdk:"dedicated_ipfo" json:"dedicatedIpfo,omitempty"`
DefaultFarmId *ovhtypes.TfInt64Value `tfsdk:"default_farm_id" json:"defaultFarmId,omitempty"`
Disabled *ovhtypes.TfBoolValue `tfsdk:"disabled" json:"disabled,omitempty"`
DisplayName *ovhtypes.TfStringValue `tfsdk:"display_name" json:"displayName,omitempty"`
Port *ovhtypes.TfStringValue `tfsdk:"port" json:"port,omitempty"`
Zone *ovhtypes.TfStringValue `tfsdk:"zone" json:"zone,omitempty"`
}
func (v IploadbalancingUdpFrontendModel) ToCreate() *IploadbalancingUdpFrontendWritableModel {
res := &IploadbalancingUdpFrontendWritableModel{}
if !v.DedicatedIpfo.IsUnknown() {
res.DedicatedIpfo = &v.DedicatedIpfo
}
if !v.DefaultFarmId.IsUnknown() {
res.DefaultFarmId = &v.DefaultFarmId
}
if !v.Disabled.IsUnknown() {
res.Disabled = &v.Disabled
}
if !v.DisplayName.IsUnknown() {
res.DisplayName = &v.DisplayName
}
if !v.Port.IsUnknown() {
res.Port = &v.Port
}
if !v.Zone.IsUnknown() {
res.Zone = &v.Zone
}
return res
}
func (v IploadbalancingUdpFrontendModel) ToUpdate() *IploadbalancingUdpFrontendWritableModel {
res := &IploadbalancingUdpFrontendWritableModel{}
if !v.DedicatedIpfo.IsUnknown() {
res.DedicatedIpfo = &v.DedicatedIpfo
}
if !v.DefaultFarmId.IsUnknown() {
res.DefaultFarmId = &v.DefaultFarmId
}
if !v.Disabled.IsUnknown() {
res.Disabled = &v.Disabled
}
if !v.DisplayName.IsUnknown() {
res.DisplayName = &v.DisplayName
}
if !v.Port.IsUnknown() {
res.Port = &v.Port
}
if !v.Zone.IsUnknown() {
res.Zone = &v.Zone
}
return res
}