Skip to content

Commit

Permalink
make ready-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
himanikh committed Jan 4, 2025
1 parent 2271ecf commit bfbca8b
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 46 deletions.
25 changes: 13 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
cloud.google.com/go/gkemulticloud v1.4.1
cloud.google.com/go/iam v1.2.2
cloud.google.com/go/kms v1.20.1
cloud.google.com/go/memorystore v0.1.1
cloud.google.com/go/monitoring v1.21.2
cloud.google.com/go/privilegedaccessmanager v0.2.1
cloud.google.com/go/profiler v0.4.1
Expand Down Expand Up @@ -66,13 +67,13 @@ require (
go.opencensus.io v0.24.0
go.uber.org/zap v1.26.0
golang.org/x/oauth2 v0.24.0
golang.org/x/sync v0.9.0
golang.org/x/sync v0.10.0
golang.org/x/time v0.8.0
google.golang.org/api v0.210.0
google.golang.org/api v0.214.0
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f
google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697
google.golang.org/grpc v1.67.1
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576
google.golang.org/grpc v1.67.3
google.golang.org/protobuf v1.35.2
gopkg.in/dnaeon/go-vcr.v3 v3.2.0
gopkg.in/yaml.v2 v2.4.0
Expand All @@ -93,10 +94,10 @@ require (
bitbucket.org/creachadair/stringset v0.0.8 // indirect
cel.dev/expr v0.16.0 // indirect
cloud.google.com/go v0.116.0 // indirect
cloud.google.com/go/auth v0.11.0 // indirect
cloud.google.com/go/auth v0.13.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect
cloud.google.com/go/bigtable v1.33.0 // indirect
cloud.google.com/go/compute/metadata v0.5.2 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/longrunning v0.6.2 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
Expand Down Expand Up @@ -224,12 +225,12 @@ require (
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.27.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
Expand Down
50 changes: 26 additions & 24 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 33 additions & 10 deletions pkg/controller/direct/memorystore/mapper.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package memorystore

import (
pb "cloud.google.com/go/memorystore/apiv1beta/memorystorepb"
krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/memorystore/v1alpha1"
refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"
)

func PscAutoConnectionSpec_FromProto(mapCtx *direct.MapContext, in *pb.PscAutoConnectionSpec) *krm.PscAutoConnectionSpec {
func PscAutoConnectionSpec_FromProto(mapCtx *direct.MapContext, in *pb.PscAutoConnection) *krm.PscAutoConnectionSpec {
if in == nil {
return nil
}
out := &krm.PscAutoConnectionSpec{}
out.NetworkRef = direct.LazyPtr(in.GetNetworkRef())
out.ProjectRef = direct.LazyPtr(in.GetProjectRef())
if in.Network != "" {
out.NetworkRef = &refs.ComputeNetworkRef{External: in.Network}
}
if in.ProjectId != "" {
out.ProjectRef = &refs.ProjectRef{External: in.ProjectId}
}
return out
}
func PscAutoConnectionSpec_ToProto(mapCtx *direct.MapContext, in *krm.PscAutoConnectionSpec) *pb.PscAutoConnectionSpec {
func PscAutoConnectionSpec_ToProto(mapCtx *direct.MapContext, in *krm.PscAutoConnectionSpec) *pb.PscAutoConnection {
if in == nil {
return nil
}
out := &pb.PscAutoConnectionSpec{}
out.NetworkRef = direct.ValueOf(in.NetworkRef)
out.ProjectRef = direct.ValueOf(in.ProjectRef)
out := &pb.PscAutoConnection{}
if in.NetworkRef != nil {
out.Network = in.NetworkRef.External
}
if in.ProjectRef != nil {
out.ProjectId = in.ProjectRef.External
}
return out
}
func MemorystoreInstanceSpec_FromProto(mapCtx *direct.MapContext, in *pb.Instance) *krm.MemorystoreInstanceSpec {
Expand All @@ -39,8 +62,8 @@ func MemorystoreInstanceSpec_FromProto(mapCtx *direct.MapContext, in *pb.Instanc
out.EngineConfigs = in.EngineConfigs
out.ZoneDistributionConfig = ZoneDistributionConfig_FromProto(mapCtx, in.GetZoneDistributionConfig())
out.DeletionProtectionEnabled = in.DeletionProtectionEnabled
for _, pscConfig := range in.GetPscAutoConnectionsSpec() {
out.PscAutoConnectionsSpec = append(out.PscAutoConnectionsSpec, *PscAutoConnectionSpec_FromProto(mapCtx, &pscConfig))
for _, pscConfig := range in.GetPscAutoConnections() {
out.PscAutoConnectionsSpec = append(out.PscAutoConnectionsSpec, *PscAutoConnectionSpec_FromProto(mapCtx, pscConfig))
}
return out
}
Expand All @@ -60,7 +83,7 @@ func MemorystoreInstanceSpec_ToProto(mapCtx *direct.MapContext, in *krm.Memoryst
out.ZoneDistributionConfig = ZoneDistributionConfig_ToProto(mapCtx, in.ZoneDistributionConfig)
out.DeletionProtectionEnabled = in.DeletionProtectionEnabled
for _, pscConfig := range in.PscAutoConnectionsSpec {
out.PscAutoConnectionsSpec = append(out.PscAutoConnectionsSpec, PscAutoConnectionSpec_ToProto(mapCtx, &pscConfig))
out.PscAutoConnections = append(out.PscAutoConnections, PscAutoConnectionSpec_ToProto(mapCtx, &pscConfig))
}
return out
}

0 comments on commit bfbca8b

Please sign in to comment.