Skip to content

Commit

Permalink
Add mapper for SpannerInstance direct controller
Browse files Browse the repository at this point in the history
  • Loading branch information
anhdle-sso committed Nov 18, 2024
1 parent 151f0f4 commit 3b2698e
Show file tree
Hide file tree
Showing 5 changed files with 304 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dev/tools/controllerbuilder/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ go run . generate-mapper \
--output-dir $REPO_ROOT/pkg/controller/direct/ \
--api-dir $REPO_ROOT/apis/

go run . generate-direct-reconciler \
--kind SecretManagerSecretVersion \
--proto-resource SecretVersion \
--api-version "secretmanager.cnrm.cloud.google.com/v1beta1" \
--service "google.cloud.secretmanager.v1" \
--proto-source-path ../proto-to-mapper/build/googleapis.pb

# Spanner
go run main.go generate-types \
--service google.spanner.admin.instance.v1 \
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
cloud.google.com/go/secretmanager v1.14.1
cloud.google.com/go/securesourcemanager v1.1.1
cloud.google.com/go/security v1.18.1
cloud.google.com/go/spanner v1.70.0
cloud.google.com/go/workstations v1.1.1
contrib.go.opencensus.io/exporter/prometheus v0.1.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.62.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum

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

228 changes: 228 additions & 0 deletions pkg/controller/direct/spanner/mapper.generated.go

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

66 changes: 66 additions & 0 deletions pkg/controller/direct/spanner/spannerinstace_mapper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2024 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 spanner

import (
pb "cloud.google.com/go/spanner/admin/instance/apiv1/instancepb"
// krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/spanner/v1beta1"
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"
)

func AutoscalingConfig_AutoscalingLimits_MinNodes_ToProto(mapCtx *direct.MapContext, m *int32) *pb.AutoscalingConfig_AutoscalingLimits_MinNodes {
if m == nil {
return nil
}
return &pb.AutoscalingConfig_AutoscalingLimits_MinNodes{
MinNodes: direct.ValueOf(m),
}
}
func AutoscalingConfig_AutoscalingLimits_MinProcessingUnits_ToProto(mapCtx *direct.MapContext, m *int32) *pb.AutoscalingConfig_AutoscalingLimits_MinProcessingUnits {
if m == nil {
return nil
}
return &pb.AutoscalingConfig_AutoscalingLimits_MinProcessingUnits{
MinProcessingUnits: direct.ValueOf(m),
}
}
func AutoscalingConfig_AutoscalingLimits_MaxNodes_ToProto(mapCtx *direct.MapContext, m *int32) *pb.AutoscalingConfig_AutoscalingLimits_MaxNodes {
if m == nil {
return nil
}
return &pb.AutoscalingConfig_AutoscalingLimits_MaxNodes{
MaxNodes: direct.ValueOf(m),
}
}
func AutoscalingConfig_AutoscalingLimits_MaxProcessingUnits_ToProto(mapCtx *direct.MapContext, m *int32) *pb.AutoscalingConfig_AutoscalingLimits_MaxProcessingUnits {
if m == nil {
return nil
}
return &pb.AutoscalingConfig_AutoscalingLimits_MaxProcessingUnits{
MaxProcessingUnits: direct.ValueOf(m),
}
}
func ReplicaComputeCapacity_NodeCount_ToProto(mapCtx *direct.MapContext, m *int32) *pb.ReplicaComputeCapacity_NodeCount {
if m == nil {
return nil
}
return &pb.ReplicaComputeCapacity_NodeCount{NodeCount: direct.ValueOf(m)}
}
func ReplicaComputeCapacity_ProcessingUnits_ToProto(mapCtx *direct.MapContext, m *int32) *pb.ReplicaComputeCapacity_ProcessingUnits {
if m == nil {
return nil
}
return &pb.ReplicaComputeCapacity_ProcessingUnits{ProcessingUnits: direct.ValueOf(m)}
}

0 comments on commit 3b2698e

Please sign in to comment.