@@ -33,8 +33,8 @@ import (
3333type LoadBalancerProbe struct {
3434 // Name is the probe name, e.g. "Health-HTTPS-3988".
3535 Name string
36- // Protocol is the probe protocol: "Tcp", "Http", or "Https" .
37- Protocol string
36+ // Protocol is the probe protocol, e.g. network.ProbeProtocolTCP .
37+ Protocol network. ProbeProtocol
3838 // Port is the port to probe.
3939 Port int32
4040 // RequestPath is the path for HTTP/HTTPS probes (nil for TCP).
@@ -59,6 +59,14 @@ type LoadBalancerRule struct {
5959 Port int32
6060 // ProbeName references the probe by name.
6161 ProbeName string
62+ // Protocol is the transport protocol, e.g. network.TransportProtocolTCP.
63+ Protocol network.TransportProtocol
64+ // IdleTimeoutInMinutes is the idle timeout for the rule.
65+ IdleTimeoutInMinutes int32
66+ // EnableFloatingIP enables Direct Server Return.
67+ EnableFloatingIP bool
68+ // LoadDistribution is the load distribution policy.
69+ LoadDistribution network.LoadDistribution
6270}
6371
6472var _ fi.CloudupHasDependencies = (* LoadBalancerRule )(nil )
@@ -83,6 +91,9 @@ type LoadBalancer struct {
8391
8492 Tags map [string ]* string
8593
94+ // SKU is the load balancer SKU, e.g. network.LoadBalancerSKUNameStandard.
95+ SKU network.LoadBalancerSKUName
96+
8697 // WellKnownServices indicates which services are supported by this resource.
8798 // This field is internal and is not rendered to the cloud.
8899 WellKnownServices []wellknownservices.WellKnownService
@@ -179,6 +190,9 @@ func (lb *LoadBalancer) Find(c *fi.CloudupContext) (*LoadBalancer, error) {
179190 External : to .Ptr (feConfig .Properties .PublicIPAddress != nil ),
180191 Tags : found .Tags ,
181192 }
193+ if found .SKU != nil {
194+ actual .SKU = fi .ValueOf (found .SKU .Name )
195+ }
182196 if subnet != nil {
183197 actual .Subnet = & Subnet {
184198 Name : subnet .Name ,
@@ -196,7 +210,7 @@ func (lb *LoadBalancer) Find(c *fi.CloudupContext) (*LoadBalancer, error) {
196210 }
197211 p := LoadBalancerProbe {
198212 Name : fi .ValueOf (probe .Name ),
199- Protocol : string ( fi .ValueOf (probe .Properties .Protocol ) ),
213+ Protocol : fi .ValueOf (probe .Properties .Protocol ),
200214 Port : fi .ValueOf (probe .Properties .Port ),
201215 IntervalInSeconds : fi .ValueOf (probe .Properties .IntervalInSeconds ),
202216 NumberOfProbes : fi .ValueOf (probe .Properties .NumberOfProbes ),
@@ -212,8 +226,12 @@ func (lb *LoadBalancer) Find(c *fi.CloudupContext) (*LoadBalancer, error) {
212226 continue
213227 }
214228 r := LoadBalancerRule {
215- Name : fi .ValueOf (rule .Name ),
216- Port : fi .ValueOf (rule .Properties .FrontendPort ),
229+ Name : fi .ValueOf (rule .Name ),
230+ Port : fi .ValueOf (rule .Properties .FrontendPort ),
231+ Protocol : fi .ValueOf (rule .Properties .Protocol ),
232+ IdleTimeoutInMinutes : fi .ValueOf (rule .Properties .IdleTimeoutInMinutes ),
233+ EnableFloatingIP : fi .ValueOf (rule .Properties .EnableFloatingIP ),
234+ LoadDistribution : fi .ValueOf (rule .Properties .LoadDistribution ),
217235 }
218236 if rule .Properties .Probe != nil && rule .Properties .Probe .ID != nil {
219237 // Extract probe name from the full resource ID
@@ -277,7 +295,7 @@ func (*LoadBalancer) RenderAzure(t *azure.AzureAPITarget, a, e, changes *LoadBal
277295 lb := network.LoadBalancer {
278296 Location : to .Ptr (t .Cloud .Region ()),
279297 SKU : & network.LoadBalancerSKU {
280- Name : to .Ptr (network . LoadBalancerSKUNameStandard ),
298+ Name : to .Ptr (e . SKU ),
281299 },
282300 Properties : & network.LoadBalancerPropertiesFormat {
283301 FrontendIPConfigurations : []* network.FrontendIPConfiguration {
@@ -299,7 +317,7 @@ func (*LoadBalancer) RenderAzure(t *azure.AzureAPITarget, a, e, changes *LoadBal
299317 p := & network.Probe {
300318 Name : to .Ptr (probe .Name ),
301319 Properties : & network.ProbePropertiesFormat {
302- Protocol : to .Ptr (network . ProbeProtocol ( probe .Protocol ) ),
320+ Protocol : to .Ptr (probe .Protocol ),
303321 Port : to .Ptr (probe .Port ),
304322 IntervalInSeconds : to .Ptr (probe .IntervalInSeconds ),
305323 NumberOfProbes : to .Ptr (probe .NumberOfProbes ),
@@ -315,12 +333,12 @@ func (*LoadBalancer) RenderAzure(t *azure.AzureAPITarget, a, e, changes *LoadBal
315333 lb .Properties .LoadBalancingRules = append (lb .Properties .LoadBalancingRules , & network.LoadBalancingRule {
316334 Name : to .Ptr (rule .Name ),
317335 Properties : & network.LoadBalancingRulePropertiesFormat {
318- Protocol : to .Ptr (network . TransportProtocolTCP ),
336+ Protocol : to .Ptr (rule . Protocol ),
319337 FrontendPort : to .Ptr (rule .Port ),
320338 BackendPort : to .Ptr (rule .Port ),
321- IdleTimeoutInMinutes : to.Ptr [ int32 ]( 4 ),
322- EnableFloatingIP : to .Ptr (false ),
323- LoadDistribution : to .Ptr (network . LoadDistributionDefault ),
339+ IdleTimeoutInMinutes : to .Ptr ( rule . IdleTimeoutInMinutes ),
340+ EnableFloatingIP : to .Ptr (rule . EnableFloatingIP ),
341+ LoadDistribution : to .Ptr (rule . LoadDistribution ),
324342 FrontendIPConfiguration : & network.SubResource {
325343 ID : to .Ptr (fmt .Sprintf ("/%s/loadbalancers/%s/frontendIPConfigurations/%s" , idPrefix , * e .Name , "LoadBalancerFrontEnd" )),
326344 },
0 commit comments