@@ -231,8 +231,8 @@ func (e *EMLB) ReconcileVIPOrigin(ctx context.Context, machineScope *scope.Machi
231
231
return nil
232
232
}
233
233
234
- // DeleteLoadBalancer deletes the Equinix Metal Load Balancer associated with a given ClusterScope.
235
- func (e * EMLB ) DeleteLoadBalancer (ctx context.Context , clusterScope * scope.ClusterScope ) error {
234
+ // DeleteClusterLoadBalancer deletes the Equinix Metal Load Balancer associated with a given ClusterScope.
235
+ func (e * EMLB ) DeleteClusterLoadBalancer (ctx context.Context , clusterScope * scope.ClusterScope ) error {
236
236
log := ctrl .LoggerFrom (ctx )
237
237
238
238
packetCluster := clusterScope .PacketCluster
@@ -247,7 +247,7 @@ func (e *EMLB) DeleteLoadBalancer(ctx context.Context, clusterScope *scope.Clust
247
247
248
248
log .Info ("Deleting EMLB" , "Cluster Metro" , e .metro , "Cluster Name" , clusterName , "Project ID" , e .projectID , "Load Balancer ID" , lbID )
249
249
250
- resp , err := e .deleteLoadBalancer (ctx , lbID )
250
+ resp , err := e .DeleteLoadBalancer (ctx , lbID )
251
251
if err != nil {
252
252
if resp .StatusCode == http .StatusNotFound {
253
253
return nil
@@ -273,7 +273,7 @@ func (e *EMLB) DeleteLoadBalancerOrigin(ctx context.Context, machineScope *scope
273
273
274
274
log .Info ("Deleting EMLB Pool" , "Cluster Metro" , e .metro , "Cluster Name" , clusterName , "Project ID" , e .projectID , "Pool ID" , lbPoolID )
275
275
276
- resp , err := e .deletePool (ctx , lbPoolID )
276
+ resp , err := e .DeleteLoadBalancerPool (ctx , lbPoolID )
277
277
if err != nil {
278
278
if resp .StatusCode != http .StatusNotFound {
279
279
return nil
@@ -284,6 +284,22 @@ func (e *EMLB) DeleteLoadBalancerOrigin(ctx context.Context, machineScope *scope
284
284
return err
285
285
}
286
286
287
+ // GetLoadBalancers returns a Load Balancer Collection of all the Equinix Metal Load Balancers in a project.
288
+ func (e * EMLB ) GetLoadBalancers (ctx context.Context ) (* lbaas.LoadBalancerCollection , * http.Response , error ) {
289
+ ctx = context .WithValue (ctx , lbaas .ContextOAuth2 , e .tokenExchanger )
290
+
291
+ LoadBalancerCollection , resp , err := e .client .ProjectsApi .ListLoadBalancers (ctx , e .projectID ).Execute ()
292
+ return LoadBalancerCollection , resp , err
293
+ }
294
+
295
+ // GetLoadBalancerPools returns a Load Balancer Collection of all the Equinix Metal Load Balancers in a project.
296
+ func (e * EMLB ) GetLoadBalancerPools (ctx context.Context ) (* lbaas.LoadBalancerPoolCollection , * http.Response , error ) {
297
+ ctx = context .WithValue (ctx , lbaas .ContextOAuth2 , e .tokenExchanger )
298
+
299
+ LoadBalancerPoolCollection , resp , err := e .client .ProjectsApi .ListPools (ctx , e .projectID ).Execute ()
300
+ return LoadBalancerPoolCollection , resp , err
301
+ }
302
+
287
303
// getLoadBalancer Returns a Load Balancer object given an id.
288
304
func (e * EMLB ) getLoadBalancer (ctx context.Context , id string ) (* lbaas.LoadBalancer , * http.Response , error ) {
289
305
ctx = context .WithValue (ctx , lbaas .ContextOAuth2 , e .tokenExchanger )
@@ -452,12 +468,14 @@ func (e *EMLB) createOrigin(ctx context.Context, poolID, originName string, targ
452
468
return e .client .PoolsApi .CreateLoadBalancerPoolOrigin (ctx , poolID ).LoadBalancerPoolOriginCreate (createOriginRequest ).Execute ()
453
469
}
454
470
455
- func (e * EMLB ) deleteLoadBalancer (ctx context.Context , lbID string ) (* http.Response , error ) {
471
+ // DeleteLoadBalancer deletes an Equinix Metal Load Balancer given an ID.
472
+ func (e * EMLB ) DeleteLoadBalancer (ctx context.Context , lbID string ) (* http.Response , error ) {
456
473
ctx = context .WithValue (ctx , lbaas .ContextOAuth2 , e .tokenExchanger )
457
474
return e .client .LoadBalancersApi .DeleteLoadBalancer (ctx , lbID ).Execute ()
458
475
}
459
476
460
- func (e * EMLB ) deletePool (ctx context.Context , poolID string ) (* http.Response , error ) {
477
+ // DeleteLoadBalancerPool deletes an Equinix Metal Load Balancer Origin Pool given an ID.
478
+ func (e * EMLB ) DeleteLoadBalancerPool (ctx context.Context , poolID string ) (* http.Response , error ) {
461
479
ctx = context .WithValue (ctx , lbaas .ContextOAuth2 , e .tokenExchanger )
462
480
return e .client .PoolsApi .DeleteLoadBalancerPool (ctx , poolID ).Execute ()
463
481
}
0 commit comments