Skip to content

Commit

Permalink
Merge pull request #3300 from jingyih/refactor
Browse files Browse the repository at this point in the history
chore: do not import direct package in apis/
  • Loading branch information
google-oss-prow[bot] authored Dec 4, 2024
2 parents 6741bc5 + eae44c5 commit 95137e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions apis/bigqueryconnection/v1alpha1/connection_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"fmt"
"strings"

"github.com/GoogleCloudPlatform/k8s-config-connector/apis/common"
refsv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/k8s"
"github.com/google/uuid"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -45,15 +45,15 @@ func NewBigQueryConnectionConnectionRef(ctx context.Context, reader client.Reade
location := obj.Spec.Location

// Get desired service-generated ID from spec
desiredServiceID := direct.ValueOf(obj.Spec.ResourceID)
desiredServiceID := common.ValueOf(obj.Spec.ResourceID)
if desiredServiceID != "" {
if _, err := uuid.Parse(desiredServiceID); err != nil {
return nil, fmt.Errorf("spec.resourceID should be in a UUID format, got %s ", desiredServiceID)
}
}

// Get externalReference
externalRef := direct.ValueOf(obj.Status.ExternalRef)
externalRef := common.ValueOf(obj.Status.ExternalRef)
if externalRef != "" {
tokens := strings.Split(externalRef, "/")

Expand Down
5 changes: 2 additions & 3 deletions apis/compute/v1beta1/targettcpproxy_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import (
"fmt"
"strings"

"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"

"github.com/GoogleCloudPlatform/k8s-config-connector/apis/common"
refsv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/k8s"
apierrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -102,7 +101,7 @@ func NewComputeTargetTCPProxyRef(ctx context.Context, reader client.Reader, obj
if obj.Spec.Location == nil {
id.parent = &ComputeTargetTCPProxyParent{ProjectID: projectID, Region: "global"}
} else {
region := direct.ValueOf(obj.Spec.Location)
region := common.ValueOf(obj.Spec.Location)
id.parent = &ComputeTargetTCPProxyParent{ProjectID: projectID, Region: region}
}

Expand Down

0 comments on commit 95137e8

Please sign in to comment.