From 7634fe539a45f7629d778930a16a3cdc71a1ecc3 Mon Sep 17 00:00:00 2001 From: Joe Kratzat Date: Wed, 6 Apr 2022 16:28:57 -0400 Subject: [PATCH] fix: refactor the service clients We want to be more consistent with naming https://go.dev/blog/package-names --- cloud/ociutil/ociutil.go | 2 +- cloud/scope/clients.go | 4 ++-- cloud/scope/clients_mock.go | 2 +- cloud/scope/cluster.go | 4 ++-- cloud/scope/machine.go | 8 ++++---- cloud/services/compute/client.go | 2 +- cloud/services/networkloadbalancer/client.go | 2 +- test/e2e/e2e_suite_test.go | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cloud/ociutil/ociutil.go b/cloud/ociutil/ociutil.go index 02a874d1..832dd8eb 100644 --- a/cloud/ociutil/ociutil.go +++ b/cloud/ociutil/ociutil.go @@ -55,7 +55,7 @@ func IsNotFound(err error) bool { } // AwaitLBWorkRequest waits for the LB work request to either succeed, fail. See k8s.io/apimachinery/pkg/util/wait -func AwaitLBWorkRequest(ctx context.Context, networkLoadBalancerClient nlb.NetworkLoadBalancerClient, workRequestId *string) (*networkloadbalancer.WorkRequest, error) { +func AwaitLBWorkRequest(ctx context.Context, networkLoadBalancerClient nlb.Client, workRequestId *string) (*networkloadbalancer.WorkRequest, error) { var wr *networkloadbalancer.WorkRequest err := wait.PollWithContext(ctx, WorkRequestPollInterval, WorkRequestTimeout, func(ctx context.Context) (done bool, err error) { twr, err := networkLoadBalancerClient.GetWorkRequest(ctx, networkloadbalancer.GetWorkRequestRequest{ diff --git a/cloud/scope/clients.go b/cloud/scope/clients.go index 4e700500..ab872063 100644 --- a/cloud/scope/clients.go +++ b/cloud/scope/clients.go @@ -34,9 +34,9 @@ import ( // OCIClients is the struct of all the needed OCI clients type OCIClients struct { - ComputeClient compute.ComputeClient + ComputeClient compute.Client VCNClient vcn.Client - LoadBalancerClient nlb.NetworkLoadBalancerClient + LoadBalancerClient nlb.Client IdentityClient identityClient.Client } diff --git a/cloud/scope/clients_mock.go b/cloud/scope/clients_mock.go index f153baeb..0226926d 100644 --- a/cloud/scope/clients_mock.go +++ b/cloud/scope/clients_mock.go @@ -35,7 +35,7 @@ import ( type MockOCIClients struct { VCNClient vcn.Client - ComputeClient compute.ComputeClient + ComputeClient compute.Client LoadBalancerClient *networkloadbalancer.NetworkLoadBalancerClient IdentityClient *identity.IdentityClient } diff --git a/cloud/scope/cluster.go b/cloud/scope/cluster.go index 7914c73d..317eb54d 100644 --- a/cloud/scope/cluster.go +++ b/cloud/scope/cluster.go @@ -50,7 +50,7 @@ type ClusterScopeParams struct { Cluster *clusterv1.Cluster OCICluster *infrastructurev1beta1.OCICluster VCNClient vcn.Client - LoadBalancerClient nlb.NetworkLoadBalancerClient + LoadBalancerClient nlb.Client IdentityClient identityClent.Client Region string OCIAuthConfigProvider common.ConfigurationProvider @@ -64,7 +64,7 @@ type ClusterScope struct { Cluster *clusterv1.Cluster OCICluster *infrastructurev1beta1.OCICluster VCNClient vcn.Client - LoadBalancerClient nlb.NetworkLoadBalancerClient + LoadBalancerClient nlb.Client IdentityClient identityClent.Client Region string } diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index c62a7829..d4bd014b 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -54,11 +54,11 @@ type MachineScopeParams struct { Cluster *clusterv1.Cluster Machine *clusterv1.Machine Client client.Client - ComputeClient compute.ComputeClient + ComputeClient compute.Client OCICluster *infrastructurev1beta1.OCICluster OCIMachine *infrastructurev1beta1.OCIMachine VCNClient vcn.Client - NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient + NetworkLoadBalancerClient nlb.Client } type MachineScope struct { @@ -67,11 +67,11 @@ type MachineScope struct { patchHelper *patch.Helper Cluster *clusterv1.Cluster Machine *clusterv1.Machine - ComputeClient compute.ComputeClient + ComputeClient compute.Client OCICluster *infrastructurev1beta1.OCICluster OCIMachine *infrastructurev1beta1.OCIMachine VCNClient vcn.Client - NetworkLoadBalancerClient nlb.NetworkLoadBalancerClient + NetworkLoadBalancerClient nlb.Client } // NewMachineScope creates a MachineScope given the MachineScopeParams diff --git a/cloud/services/compute/client.go b/cloud/services/compute/client.go index 9996d81c..2b6af434 100644 --- a/cloud/services/compute/client.go +++ b/cloud/services/compute/client.go @@ -22,7 +22,7 @@ import ( "github.com/oracle/oci-go-sdk/v63/core" ) -type ComputeClient interface { +type Client interface { LaunchInstance(ctx context.Context, request core.LaunchInstanceRequest) (response core.LaunchInstanceResponse, err error) TerminateInstance(ctx context.Context, request core.TerminateInstanceRequest) (response core.TerminateInstanceResponse, err error) GetInstance(ctx context.Context, request core.GetInstanceRequest) (response core.GetInstanceResponse, err error) diff --git a/cloud/services/networkloadbalancer/client.go b/cloud/services/networkloadbalancer/client.go index 1b3e25d2..5b35b5d7 100644 --- a/cloud/services/networkloadbalancer/client.go +++ b/cloud/services/networkloadbalancer/client.go @@ -21,7 +21,7 @@ import ( "github.com/oracle/oci-go-sdk/v63/networkloadbalancer" ) -type NetworkLoadBalancerClient interface { +type Client interface { ListNetworkLoadBalancers(ctx context.Context, request networkloadbalancer.ListNetworkLoadBalancersRequest) (response networkloadbalancer.ListNetworkLoadBalancersResponse, err error) GetNetworkLoadBalancer(ctx context.Context, request networkloadbalancer.GetNetworkLoadBalancerRequest) (response networkloadbalancer.GetNetworkLoadBalancerResponse, err error) CreateBackend(ctx context.Context, request networkloadbalancer.CreateBackendRequest) (response networkloadbalancer.CreateBackendResponse, err error) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 99760d0e..e7943454 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -97,11 +97,11 @@ var ( // usePRArtifacts specifies whether or not to use the build from a PR of the Kubernetes repository usePRArtifacts bool - computeClient compute.ComputeClient + computeClient compute.Client vcnClient vcn.Client - lbClient nlb.NetworkLoadBalancerClient + lbClient nlb.Client adCount int )