Skip to content

Commit

Permalink
Sort the functions alphabaticaly
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik-K-N committed Nov 25, 2024
1 parent 0baf9bc commit ec7ad55
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 228 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ type PowerVSClusterBuilder struct {
namespace string

// Spec fields.
network capibmv1.IBMPowerVSResourceReference
controlPlaneEndpoint clusterv1.APIEndpoint
zone *string
serviceInstance *capibmv1.IBMPowerVSResourceReference
resourceGroup *capibmv1.IBMPowerVSResourceReference
loadBalancers []capibmv1.VPCLoadBalancerSpec
network capibmv1.IBMPowerVSResourceReference
resourceGroup *capibmv1.IBMPowerVSResourceReference
serviceInstance *capibmv1.IBMPowerVSResourceReference
zone *string

// Status fields.
conditions clusterv1.Conditions
Expand Down Expand Up @@ -128,27 +128,21 @@ func (p PowerVSClusterBuilder) WithNamespace(namespace string) PowerVSClusterBui

// Spec fields.

// WithNetwork sets the network for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithNetwork(network capibmv1.IBMPowerVSResourceReference) PowerVSClusterBuilder {
p.network = network
return p
}

// WithControlPlaneEndpoint sets the controlPlaneEndpoint for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithControlPlaneEndpoint(endpoint clusterv1.APIEndpoint) PowerVSClusterBuilder {
p.controlPlaneEndpoint = endpoint
return p
}

// WithZone sets the zone for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithZone(zone *string) PowerVSClusterBuilder {
p.zone = zone
// WithLoadBalancer sets the loadBalancers for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithLoadBalancer(loadBalancers []capibmv1.VPCLoadBalancerSpec) PowerVSClusterBuilder {
p.loadBalancers = loadBalancers
return p
}

// WithServiceInstance sets the serviceInstance for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithServiceInstance(serviceInstance *capibmv1.IBMPowerVSResourceReference) PowerVSClusterBuilder {
p.serviceInstance = serviceInstance
// WithNetwork sets the network for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithNetwork(network capibmv1.IBMPowerVSResourceReference) PowerVSClusterBuilder {
p.network = network
return p
}

Expand All @@ -158,9 +152,15 @@ func (p PowerVSClusterBuilder) WithResourceGroup(resourceGroup *capibmv1.IBMPowe
return p
}

// WithLoadBalancer sets the loadBalancers for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithLoadBalancer(loadBalancers []capibmv1.VPCLoadBalancerSpec) PowerVSClusterBuilder {
p.loadBalancers = loadBalancers
// WithServiceInstance sets the serviceInstance for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithServiceInstance(serviceInstance *capibmv1.IBMPowerVSResourceReference) PowerVSClusterBuilder {
p.serviceInstance = serviceInstance
return p
}

// WithZone sets the zone for the IBMPowerVSCluster builder.
func (p PowerVSClusterBuilder) WithZone(zone *string) PowerVSClusterBuilder {
p.zone = zone
return p
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ var _ = Describe("IBMPowerVSCluster", func() {

// Spec fields.

Describe("WithNetwork", func() {
network := capibmv1.IBMPowerVSResourceReference{Name: ptr.To("network-name")}
It("should return the custom value when specified", func() {
powerVSCluster := PowerVSCluster().WithNetwork(network).Build()
Expect(powerVSCluster.Spec.Network).To(Equal(network))
})
})

Describe("WithControlPlaneEndpoint", func() {
endpoint := clusterv1.APIEndpoint{Host: "example.com", Port: 6443}
It("should return the custom value when specified", func() {
Expand All @@ -111,19 +103,19 @@ var _ = Describe("IBMPowerVSCluster", func() {
})
})

Describe("WithZone", func() {
zone := ptr.To("test-zone")
Describe("WithLoadBalancer", func() {
loadBalancers := []capibmv1.VPCLoadBalancerSpec{{Name: "loadBalancer"}}
It("should return the custom value when specified", func() {
powerVSCluster := PowerVSCluster().WithZone(zone).Build()
Expect(powerVSCluster.Spec.Zone).To(Equal(zone))
powerVSCluster := PowerVSCluster().WithLoadBalancer(loadBalancers).Build()
Expect(powerVSCluster.Spec.LoadBalancers).To(Equal(loadBalancers))
})
})

Describe("WithServiceInstance", func() {
serviceInstance := &capibmv1.IBMPowerVSResourceReference{Name: ptr.To("service-instance")}
Describe("WithNetwork", func() {
network := capibmv1.IBMPowerVSResourceReference{Name: ptr.To("network-name")}
It("should return the custom value when specified", func() {
powerVSCluster := PowerVSCluster().WithServiceInstance(serviceInstance).Build()
Expect(powerVSCluster.Spec.ServiceInstance).To(Equal(serviceInstance))
powerVSCluster := PowerVSCluster().WithNetwork(network).Build()
Expect(powerVSCluster.Spec.Network).To(Equal(network))
})
})

Expand All @@ -135,11 +127,19 @@ var _ = Describe("IBMPowerVSCluster", func() {
})
})

Describe("WithLoadBalancer", func() {
loadBalancers := []capibmv1.VPCLoadBalancerSpec{{Name: "loadBalancer"}}
Describe("WithServiceInstance", func() {
serviceInstance := &capibmv1.IBMPowerVSResourceReference{Name: ptr.To("service-instance")}
It("should return the custom value when specified", func() {
powerVSCluster := PowerVSCluster().WithLoadBalancer(loadBalancers).Build()
Expect(powerVSCluster.Spec.LoadBalancers).To(Equal(loadBalancers))
powerVSCluster := PowerVSCluster().WithServiceInstance(serviceInstance).Build()
Expect(powerVSCluster.Spec.ServiceInstance).To(Equal(serviceInstance))
})
})

Describe("WithZone", func() {
zone := ptr.To("test-zone")
It("should return the custom value when specified", func() {
powerVSCluster := PowerVSCluster().WithZone(zone).Build()
Expect(powerVSCluster.Spec.Zone).To(Equal(zone))
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ type PowerVSMachineBuilder struct {
namespace string

// Spec fields.
serviceInstance *capibmv1.IBMPowerVSResourceReference
sshKey string
image *capibmv1.IBMPowerVSResourceReference
imageRef *corev1.LocalObjectReference
systemType string
processorType capibmv1.PowerVSProcessorType
processors intstr.IntOrString
memoryGiB int32
network capibmv1.IBMPowerVSResourceReference
processors intstr.IntOrString
processorType capibmv1.PowerVSProcessorType
providerID *string
serviceInstance *capibmv1.IBMPowerVSResourceReference
sshKey string
systemType string

// Status fields.
instanceID string
ready bool
addresses []corev1.NodeAddress
instanceState capibmv1.PowerVSInstanceState
conditions clusterv1.Conditions
failureMessage *string
failureReason *errors.MachineStatusError
conditions clusterv1.Conditions
instanceID string
instanceState capibmv1.PowerVSInstanceState
ready bool
}

func (p PowerVSMachineBuilder) Build() *capibmv1.IBMPowerVSMachine {
Expand Down Expand Up @@ -124,18 +124,6 @@ func (p PowerVSMachineBuilder) WithNamespace(namespace string) PowerVSMachineBui

// Spec fields.

// WithServiceInstance sets the serviceInstance for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithServiceInstance(serviceInstance *capibmv1.IBMPowerVSResourceReference) PowerVSMachineBuilder {
p.serviceInstance = serviceInstance
return p
}

// WithSSHKey sets the sshKey for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithSSHKey(sshKey string) PowerVSMachineBuilder {
p.sshKey = sshKey
return p
}

// WithImage sets the image for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithImage(image *capibmv1.IBMPowerVSResourceReference) PowerVSMachineBuilder {
p.image = image
Expand All @@ -148,15 +136,15 @@ func (p PowerVSMachineBuilder) WithImageRef(imageRef *corev1.LocalObjectReferenc
return p
}

// WithSystemType sets the systemType for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithSystemType(systemType string) PowerVSMachineBuilder {
p.systemType = systemType
// WithMemoryGiB sets the memoryGiB for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithMemoryGiB(memoryGiB int32) PowerVSMachineBuilder {
p.memoryGiB = memoryGiB
return p
}

// WithProcessorType sets the processorType for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithProcessorType(processorType capibmv1.PowerVSProcessorType) PowerVSMachineBuilder {
p.processorType = processorType
// WithNetwork sets the network for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithNetwork(network capibmv1.IBMPowerVSResourceReference) PowerVSMachineBuilder {
p.network = network
return p
}

Expand All @@ -166,15 +154,9 @@ func (p PowerVSMachineBuilder) WithProcessors(processors intstr.IntOrString) Pow
return p
}

// WithMemoryGiB sets the memoryGiB for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithMemoryGiB(memoryGiB int32) PowerVSMachineBuilder {
p.memoryGiB = memoryGiB
return p
}

// WithNetwork sets the network for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithNetwork(network capibmv1.IBMPowerVSResourceReference) PowerVSMachineBuilder {
p.network = network
// WithProcessorType sets the processorType for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithProcessorType(processorType capibmv1.PowerVSProcessorType) PowerVSMachineBuilder {
p.processorType = processorType
return p
}

Expand All @@ -184,29 +166,35 @@ func (p PowerVSMachineBuilder) WithProviderID(providerID *string) PowerVSMachine
return p
}

// Status fields.
// WithServiceInstance sets the serviceInstance for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithServiceInstance(serviceInstance *capibmv1.IBMPowerVSResourceReference) PowerVSMachineBuilder {
p.serviceInstance = serviceInstance
return p
}

// WithInstanceID sets the instanceID for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithInstanceID(instanceID string) PowerVSMachineBuilder {
p.instanceID = instanceID
// WithSSHKey sets the sshKey for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithSSHKey(sshKey string) PowerVSMachineBuilder {
p.sshKey = sshKey
return p
}

// WithReady sets the ready for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithReady(ready bool) PowerVSMachineBuilder {
p.ready = ready
// WithSystemType sets the systemType for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithSystemType(systemType string) PowerVSMachineBuilder {
p.systemType = systemType
return p
}

// Status fields.

// WithAddresses sets the addresses for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithAddresses(addresses []corev1.NodeAddress) PowerVSMachineBuilder {
p.addresses = addresses
return p
}

// WithInstanceState sets the instanceState for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithInstanceState(instanceState capibmv1.PowerVSInstanceState) PowerVSMachineBuilder {
p.instanceState = instanceState
// WithConditions sets the conditions for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithConditions(conditions clusterv1.Conditions) PowerVSMachineBuilder {
p.conditions = conditions
return p
}

Expand All @@ -222,8 +210,20 @@ func (p PowerVSMachineBuilder) WithFailureReason(failureReason *errors.MachineSt
return p
}

// WithConditions sets the conditions for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithConditions(conditions clusterv1.Conditions) PowerVSMachineBuilder {
p.conditions = conditions
// WithInstanceID sets the instanceID for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithInstanceID(instanceID string) PowerVSMachineBuilder {
p.instanceID = instanceID
return p
}

// WithInstanceState sets the instanceState for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithInstanceState(instanceState capibmv1.PowerVSInstanceState) PowerVSMachineBuilder {
p.instanceState = instanceState
return p
}

// WithReady sets the ready for the PowerVSMachine builder.
func (p PowerVSMachineBuilder) WithReady(ready bool) PowerVSMachineBuilder {
p.ready = ready
return p
}
Loading

0 comments on commit ec7ad55

Please sign in to comment.