Skip to content

Commit

Permalink
move around functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpang777 committed Dec 18, 2024
1 parent 21f47de commit db75780
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 49 deletions.
18 changes: 18 additions & 0 deletions apis/securesourcemanager/v1alpha1/instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,24 @@ type SecureSourceManagerInstanceObservedState struct {
HostConfig *Instance_HostConfig `json:"hostConfig,omitempty"`
}

// +kcc:proto=google.cloud.securesourcemanager.v1.Instance.PrivateConfig
type Instance_PrivateConfig struct {
// Required. Immutable. Indicate if it's private instance.
IsPrivate *bool `json:"isPrivate,omitempty"`

// Required. Immutable. CA pool resource, resource must in the format of
// `projects/{project}/locations/{location}/caPools/{ca_pool}`.
CaPoolRef *refs.PrivateCACAPoolRef `json:"caPoolRef,omitempty"`

// Output only. Service Attachment for HTTP, resource is in the format of
// `projects/{project}/regions/{region}/serviceAttachments/{service_attachment}`.
HTTPServiceAttachment *string `json:"httpServiceAttachment,omitempty"`

// Output only. Service Attachment for SSH, resource is in the format of
// `projects/{project}/regions/{region}/serviceAttachments/{service_attachment}`.
SSHServiceAttachment *string `json:"sshServiceAttachment,omitempty"`
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:categories=gcp,shortName=gcpsecuresourcemanagerinstance;gcpsecuresourcemanagerinstances
Expand Down
22 changes: 0 additions & 22 deletions apis/securesourcemanager/v1alpha1/types.generated.go

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

26 changes: 0 additions & 26 deletions pkg/controller/direct/securesourcemanager/mapper.generated.go

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

28 changes: 27 additions & 1 deletion pkg/controller/direct/securesourcemanager/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package securesourcemanager

import (
pb "cloud.google.com/go/securesourcemanager/apiv1/securesourcemanagerpb"
refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"
krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/securesourcemanager/v1alpha1"

"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"
Expand Down Expand Up @@ -61,7 +62,32 @@ func OperationMetadata_EndTime_ToProto(mapCtx *direct.MapContext, in *string) *t
mapCtx.Errorf("OperationMetadata_EndTime_ToProto not implemented")
return nil
}

func Instance_PrivateConfig_FromProto(mapCtx *direct.MapContext, in *pb.Instance_PrivateConfig) *krm.Instance_PrivateConfig {
if in == nil {
return nil
}
out := &krm.Instance_PrivateConfig{}
out.IsPrivate = direct.LazyPtr(in.GetIsPrivate())
if in.GetCaPool() != "" {
out.CaPoolRef = &refs.PrivateCACAPoolRef{External: in.GetCaPool()}
}
out.HTTPServiceAttachment = direct.LazyPtr(in.GetHttpServiceAttachment())
out.SSHServiceAttachment = direct.LazyPtr(in.GetSshServiceAttachment())
return out
}
func Instance_PrivateConfig_ToProto(mapCtx *direct.MapContext, in *krm.Instance_PrivateConfig) *pb.Instance_PrivateConfig {
if in == nil {
return nil
}
out := &pb.Instance_PrivateConfig{}
out.IsPrivate = direct.ValueOf(in.IsPrivate)
if in.CaPoolRef != nil {
out.CaPool = in.CaPoolRef.External
}
out.HttpServiceAttachment = direct.ValueOf(in.HTTPServiceAttachment)
out.SshServiceAttachment = direct.ValueOf(in.SSHServiceAttachment)
return out
}
func SecureSourceManagerRepositoryObservedState_FromProto(mapCtx *direct.MapContext, in *pb.Repository) *krm.SecureSourceManagerRepositoryObservedState {
if in == nil {
return nil
Expand Down

0 comments on commit db75780

Please sign in to comment.