From 1108de1f566d99d9abe89906c5683fa77566e281 Mon Sep 17 00:00:00 2001 From: justinsb Date: Wed, 7 Aug 2024 11:42:15 -0400 Subject: [PATCH 1/8] chore: controllerbuilder better handling for enum slices --- .../pkg/codegen/mappergenerator.go | 43 +++++++------------ .../generatemapper/generatemappercommand.go | 10 ----- pkg/controller/direct/maputils.go | 34 +++++++++++++++ 3 files changed, 49 insertions(+), 38 deletions(-) diff --git a/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go b/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go index 00bcc2a0de..13da3ee538 100644 --- a/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go +++ b/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go @@ -200,6 +200,7 @@ func (v *MapperGenerator) GenerateMappers() error { } func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, pair *typePair) { + klog.V(2).InfoS("writeMapFunctionsForPair", "pair.Proto.FullName", pair.Proto.FullName(), "pair.KRMType.Name", pair.KRMType.Name) msg := pair.Proto pbTypeName := protoNameForType(msg) @@ -242,7 +243,7 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, if protoField.Cardinality() == protoreflect.Repeated { useSliceFromProtoFunction := "" - useCustomMethod := false + useCustomMethod := "" switch protoField.Kind() { case protoreflect.MessageKind: @@ -254,19 +255,14 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, useSliceFromProtoFunction = functionName case protoreflect.StringKind: if krmField.Type != "[]string" { - useCustomMethod = true - // useSliceFromProto = fmt.Sprintf("%s_%s_FromProto", goTypeName, protoFieldName) + useCustomMethod = fmt.Sprintf("%s_%s_FromProto", goTypeName, protoFieldName) } case protoreflect.EnumKind: krmElemTypeName := krmField.Type krmElemTypeName = strings.TrimPrefix(krmElemTypeName, "*") krmElemTypeName = strings.TrimPrefix(krmElemTypeName, "[]") - functionName := "Enum_FromProto" - useSliceFromProtoFunction = fmt.Sprintf("%s(mapCtx, in.%s)", - functionName, - krmFieldName, - ) + useCustomMethod = "direct.EnumSlice_FromProto" case protoreflect.FloatKind, @@ -302,11 +298,10 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, krmFieldName, useSliceFromProtoFunction, ) - } else if useCustomMethod { - methodName := fmt.Sprintf("%s_%s_FromProto", goTypeName, protoFieldName) + } else if useCustomMethod != "" { fmt.Fprintf(out, "\tout.%s = %s(mapCtx, in.%s)\n", krmFieldName, - methodName, + useCustomMethod, krmFieldName, ) } else { @@ -416,7 +411,7 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, if protoField.Cardinality() == protoreflect.Repeated { useSliceToProtoFunction := "" - useCustomMethod := false + useCustomMethod := "" switch protoField.Kind() { case protoreflect.MessageKind: @@ -429,8 +424,7 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, case protoreflect.StringKind: if krmField.Type != "[]string" { - useCustomMethod = true - //useSliceToProtoFunction = fmt.Sprintf("%s_%s_ToProto", goTypeName, protoFieldName) + useCustomMethod = fmt.Sprintf("%s_%s_ToProto", goTypeName, protoFieldName) } case protoreflect.EnumKind: @@ -439,12 +433,7 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, krmElemTypeName = strings.TrimPrefix(krmElemTypeName, "[]") protoTypeName := "pb." + protoNameForEnum(protoField.Enum()) - functionName := "direct.Enum_ToProto" - useSliceToProtoFunction = fmt.Sprintf("%s[%s](mapCtx, in.%s)", - functionName, - protoTypeName, - krmFieldName, - ) + useCustomMethod = fmt.Sprintf("direct.EnumSlice_ToProto[%s]", protoTypeName) case protoreflect.FloatKind, protoreflect.DoubleKind, @@ -480,11 +469,10 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, krmFieldName, useSliceToProtoFunction, ) - } else if useCustomMethod { - methodName := fmt.Sprintf("%s_%s_ToProto", goTypeName, protoFieldName) + } else if useCustomMethod != "" { fmt.Fprintf(out, "\tout.%s = %s(mapCtx, in.%s)\n", krmFieldName, - methodName, + useCustomMethod, krmFieldName, ) } else { @@ -577,12 +565,12 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, protoreflect.Fixed64Kind, protoreflect.BytesKind: - useCustomMethod := false + useCustomMethod := "" switch protoField.Kind() { case protoreflect.StringKind: if krmField.Type != "*string" { - useCustomMethod = true + useCustomMethod = fmt.Sprintf("%s_%s_ToProto", goTypeName, protoFieldName) } } @@ -604,11 +592,10 @@ func (v *MapperGenerator) writeMapFunctionsForPair(out io.Writer, srcDir string, fmt.Fprintf(out, "\t\tout.%s = oneof\n", oneofFieldName) fmt.Fprintf(out, "\t}\n") - } else if useCustomMethod { - methodName := fmt.Sprintf("%s_%s_ToProto", goTypeName, protoFieldName) + } else if useCustomMethod != "" { fmt.Fprintf(out, "\tout.%s = %s(mapCtx, in.%s)\n", krmFieldName, - methodName, + useCustomMethod, krmFieldName, ) } else if protoField.Kind() == protoreflect.BytesKind { diff --git a/dev/tools/controllerbuilder/pkg/commands/generatemapper/generatemappercommand.go b/dev/tools/controllerbuilder/pkg/commands/generatemapper/generatemappercommand.go index ba0dfaa9c9..3609bdc259 100644 --- a/dev/tools/controllerbuilder/pkg/commands/generatemapper/generatemappercommand.go +++ b/dev/tools/controllerbuilder/pkg/commands/generatemapper/generatemappercommand.go @@ -129,16 +129,6 @@ func RunGenerateMapper(ctx context.Context, o *GenerateMapperOptions) error { return "", false } - // protoPackagePath := string(msg.ParentFile().Package()) - // protoPackagePath = strings.TrimPrefix(protoPackagePath, "mockgcp.") - // protoPackagePath = strings.TrimPrefix(protoPackagePath, "google.") - // protoPackagePath = strings.TrimPrefix(protoPackagePath, "cloud.") - // protoPackagePath = strings.TrimSuffix(protoPackagePath, ".v1") - // protoPackagePath = strings.TrimSuffix(protoPackagePath, ".v1beta1") - // protoPackagePath = strings.TrimSuffix(protoPackagePath, ".v2") - // protoPackagePath = strings.TrimSuffix(protoPackagePath, ".admin") // e.g. bigtable.admin.v2 - // goPackage := strings.Join(strings.Split(protoPackagePath, "."), "/") - return goPackage, true } mapperGenerator := codegen.NewMapperGenerator(pathForMessage, o.OutputMapperDirectory) diff --git a/pkg/controller/direct/maputils.go b/pkg/controller/direct/maputils.go index 453980fc10..f99c7d6636 100644 --- a/pkg/controller/direct/maputils.go +++ b/pkg/controller/direct/maputils.go @@ -114,6 +114,19 @@ func Enum_ToProto[U ProtoEnum](mapCtx *MapContext, in *string) U { return 0 } +func EnumSlice_ToProto[U ProtoEnum](mapCtx *MapContext, in []string) []U { + if in == nil { + return nil + } + + var out []U + for _, s := range in { + u := Enum_ToProto[U](mapCtx, &s) + out = append(out, u) + } + return out +} + func Enum_FromProto[U ProtoEnum](mapCtx *MapContext, v U) *string { descriptor := v.Descriptor() @@ -130,6 +143,27 @@ func Enum_FromProto[U ProtoEnum](mapCtx *MapContext, v U) *string { return &s } +func EnumSlice_FromProto[U ProtoEnum](mapCtx *MapContext, in []U) []string { + if in == nil { + return nil + } + + var out []string + for _, u := range in { + // Unlike Enum_FromProto, we don't skip 0 here + descriptor := u.Descriptor() + + val := descriptor.Values().ByNumber(protoreflect.EnumNumber(u)) + if val == nil { + mapCtx.Errorf("unknown enum value %d", u) + return nil + } + s := string(val.Name()) + out = append(out, s) + } + return out +} + func LazyPtr[V comparable](v V) *V { var defaultV V if v == defaultV { From eb3ff6f923beb04cbf13962ceebcf2b3cf477c97 Mon Sep 17 00:00:00 2001 From: justinsb Date: Wed, 7 Aug 2024 13:02:50 -0400 Subject: [PATCH 2/8] chore: enhanced fuzzing support for enum lists and bytes --- pkg/test/fuzz/generate.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pkg/test/fuzz/generate.go b/pkg/test/fuzz/generate.go index da54f0ac8a..bf21da133d 100644 --- a/pkg/test/fuzz/generate.go +++ b/pkg/test/fuzz/generate.go @@ -71,19 +71,29 @@ func fillWithRandom0(t *testing.T, randStream *rand.Rand, msg protoreflect.Messa if count > 4 { count = 0 } - listVal := msg.Mutable(field).List() switch field.Kind() { case protoreflect.MessageKind: + listVal := msg.Mutable(field).List() for j := 0; j < count; j++ { el := listVal.AppendMutable() fillWithRandom0(t, randStream, el.Message()) } case protoreflect.StringKind: + listVal := msg.Mutable(field).List() for j := 0; j < count; j++ { s := randomString(randStream) listVal.Append(protoreflect.ValueOf(s)) } + case protoreflect.EnumKind: + listVal := msg.Mutable(field).List() + for j := 0; j < count; j++ { + enumDescriptor := field.Enum() + n := enumDescriptor.Values().Len() + val := enumDescriptor.Values().Get(randStream.Intn(n)) + listVal.Append(protoreflect.ValueOf(val.Number())) + } + default: t.Fatalf("unhandled field kind %v: %v", field.Kind(), field) } @@ -274,6 +284,15 @@ func Visit(msgPath string, msg protoreflect.Message, setter func(v protoreflect. visitor.VisitPrimitive(path+"[]", el, setter) } + case protoreflect.EnumKind: + for j := 0; j < count; j++ { + el := listVal.Get(j) + setter := func(v protoreflect.Value) { + listVal.Set(j, v) + } + visitor.VisitPrimitive(path+"[]", el, setter) + } + default: klog.Fatalf("unhandled field kind %v: %v", field.Kind(), field) } @@ -328,6 +347,7 @@ func Visit(msgPath string, msg protoreflect.Message, setter func(v protoreflect. protoreflect.Int64Kind, protoreflect.Uint64Kind, protoreflect.StringKind, + protoreflect.BytesKind, protoreflect.EnumKind: setter := func(v protoreflect.Value) { if v.IsValid() { From 4b36ee1d3547971920ead653b9fd3e15a4637ef7 Mon Sep 17 00:00:00 2001 From: justinsb Date: Thu, 24 Oct 2024 07:54:05 -0400 Subject: [PATCH 3/8] DiscoveryEngineDataStore: types and mappers --- .../v1alpha1/datastore_reference.go | 187 ++++++++++++++++++ .../discoveryenginedatastore_types.go | 139 +++++++++++++ apis/discoveryengine/v1alpha1/doc.go | 16 ++ .../v1alpha1/groupversion_info.go | 33 ++++ dev/tools/controllerbuilder/generate.sh | 21 ++ .../direct/discoveryengine/mapper.go | 49 +++++ pkg/controller/direct/register/register.go | 1 + 7 files changed, 446 insertions(+) create mode 100644 apis/discoveryengine/v1alpha1/datastore_reference.go create mode 100644 apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go create mode 100644 apis/discoveryengine/v1alpha1/doc.go create mode 100644 apis/discoveryengine/v1alpha1/groupversion_info.go create mode 100644 pkg/controller/direct/discoveryengine/mapper.go diff --git a/apis/discoveryengine/v1alpha1/datastore_reference.go b/apis/discoveryengine/v1alpha1/datastore_reference.go new file mode 100644 index 0000000000..25fde3c35d --- /dev/null +++ b/apis/discoveryengine/v1alpha1/datastore_reference.go @@ -0,0 +1,187 @@ +// 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 v1alpha1 + +import ( + "context" + "fmt" + "strings" + + 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" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +var _ refsv1beta1.ExternalNormalizer = &DiscoveryEngineDataStoreRef{} + +// DiscoveryEngineDataStoreRef defines the resource reference to DiscoveryEngineDataStore, which "External" field +// holds the GCP identifier for the KRM object. +type DiscoveryEngineDataStoreRef struct { + // A reference to an externally managed DiscoveryEngineDataStore resource. + // Should be in the format "projects//locations//datastores/". + External string `json:"external,omitempty"` + + // The name of a DiscoveryEngineDataStore resource. + Name string `json:"name,omitempty"` + + // The namespace of a DiscoveryEngineDataStore resource. + Namespace string `json:"namespace,omitempty"` + + parent *DiscoveryEngineDataStoreParent +} + +// NormalizedExternal provision the "External" value for other resource that depends on DiscoveryEngineDataStore. +// If the "External" is given in the other resource's spec.DiscoveryEngineDataStoreRef, the given value will be used. +// Otherwise, the "Name" and "Namespace" will be used to query the actual DiscoveryEngineDataStore object from the cluster. +func (r *DiscoveryEngineDataStoreRef) NormalizedExternal(ctx context.Context, reader client.Reader, otherNamespace string) (string, error) { + if r.External != "" && r.Name != "" { + return "", fmt.Errorf("cannot specify both name and external on %s reference", DiscoveryEngineDataStoreGVK.Kind) + } + // From given External + if r.External != "" { + if _, _, err := parseDiscoveryEngineDataStoreExternal(r.External); err != nil { + return "", err + } + return r.External, nil + } + + // From the Config Connector object + if r.Namespace == "" { + r.Namespace = otherNamespace + } + key := types.NamespacedName{Name: r.Name, Namespace: r.Namespace} + u := &unstructured.Unstructured{} + u.SetGroupVersionKind(DiscoveryEngineDataStoreGVK) + if err := reader.Get(ctx, key, u); err != nil { + if apierrors.IsNotFound(err) { + return "", k8s.NewReferenceNotFoundError(u.GroupVersionKind(), key) + } + return "", fmt.Errorf("reading referenced %s %s: %w", DiscoveryEngineDataStoreGVK, key, err) + } + // Get external from status.externalRef. This is the most trustworthy place. + actualExternalRef, _, err := unstructured.NestedString(u.Object, "status", "externalRef") + if err != nil { + return "", fmt.Errorf("reading status.externalRef: %w", err) + } + if actualExternalRef == "" { + return "", k8s.NewReferenceNotReadyError(u.GroupVersionKind(), key) + } + r.External = actualExternalRef + return r.External, nil +} + +// New builds a DiscoveryEngineDataStoreRef from the Config Connector DiscoveryEngineDataStore object. +func NewDiscoveryEngineDataStoreRef(ctx context.Context, reader client.Reader, obj *DiscoveryEngineDataStore) (*DiscoveryEngineDataStoreRef, error) { + id := &DiscoveryEngineDataStoreRef{} + + // Get Parent + projectRef, err := refsv1beta1.ResolveProject(ctx, reader, obj, obj.Spec.ProjectRef) + if err != nil { + return nil, err + } + projectID := projectRef.ProjectID + if projectID == "" { + return nil, fmt.Errorf("cannot resolve project") + } + location := obj.Spec.Location + id.parent = &DiscoveryEngineDataStoreParent{ProjectID: projectID, Location: location} + + // Get desired ID + resourceID := valueOf(obj.Spec.ResourceID) + if resourceID == "" { + resourceID = obj.GetName() + } + if resourceID == "" { + return nil, fmt.Errorf("cannot resolve resource ID") + } + + // Use approved External + externalRef := valueOf(obj.Status.ExternalRef) + if externalRef == "" { + id.External = asDiscoveryEngineDataStoreExternal(id.parent, resourceID) + return id, nil + } + + // Validate desired with actual + actualParent, actualResourceID, err := parseDiscoveryEngineDataStoreExternal(externalRef) + if err != nil { + return nil, err + } + if actualParent.ProjectID != projectID { + return nil, fmt.Errorf("spec.projectRef changed, expect %s, got %s", actualParent.ProjectID, projectID) + } + if actualParent.Location != location { + return nil, fmt.Errorf("spec.location changed, expect %s, got %s", actualParent.Location, location) + } + if actualResourceID != resourceID { + return nil, fmt.Errorf("cannot reset `metadata.name` or `spec.resourceID` to %s, since it has already assigned to %s", + resourceID, actualResourceID) + } + id.External = externalRef + id.parent = &DiscoveryEngineDataStoreParent{ProjectID: projectID, Location: location} + return id, nil +} + +func (r *DiscoveryEngineDataStoreRef) Parent() (*DiscoveryEngineDataStoreParent, error) { + if r.parent != nil { + return r.parent, nil + } + if r.External != "" { + parent, _, err := parseDiscoveryEngineDataStoreExternal(r.External) + if err != nil { + return nil, err + } + return parent, nil + } + return nil, fmt.Errorf("DiscoveryEngineDataStoreRef not initialized from `NewDiscoveryEngineDataStoreRef` or `NormalizedExternal`") +} + +type DiscoveryEngineDataStoreParent struct { + ProjectID string + Location string +} + +func (p *DiscoveryEngineDataStoreParent) String() string { + return "projects/" + p.ProjectID + "/locations/" + p.Location +} + +func asDiscoveryEngineDataStoreExternal(parent *DiscoveryEngineDataStoreParent, resourceID string) (external string) { + return parent.String() + "/datastores/" + resourceID +} + +func parseDiscoveryEngineDataStoreExternal(external string) (parent *DiscoveryEngineDataStoreParent, resourceID string, err error) { + external = strings.TrimPrefix(external, "/") + tokens := strings.Split(external, "/") + if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "datastore" { + return nil, "", fmt.Errorf("format of DiscoveryEngineDataStore external=%q was not known (use projects//locations//datastores/)", external) + } + parent = &DiscoveryEngineDataStoreParent{ + ProjectID: tokens[1], + Location: tokens[3], + } + resourceID = tokens[5] + return parent, resourceID, nil +} + +func valueOf[T any](t *T) T { + var zeroVal T + if t == nil { + return zeroVal + } + return *t +} diff --git a/apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go b/apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go new file mode 100644 index 0000000000..f9bb95f89d --- /dev/null +++ b/apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go @@ -0,0 +1,139 @@ +// 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 v1alpha1 + +import ( + refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var DiscoveryEngineDataStoreGVK = GroupVersion.WithKind("DiscoveryEngineDataStore") + +// DiscoveryEngineDataStoreSpec defines the desired state of DiscoveryEngineDataStore +// +kcc:proto=google.cloud.discoveryengine.v1.DataStore +type DiscoveryEngineDataStoreSpec struct { + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ResourceID field is immutable" + // Immutable. + // The DiscoveryEngineDataStore name. If not given, the metadata.name will be used. + ResourceID *string `json:"resourceID,omitempty"` + + // Required. The data store display name. + // + // This field must be a UTF-8 encoded string with a length limit of 128 + // characters. Otherwise, an INVALID_ARGUMENT error is returned. + DisplayName *string `json:"displayName,omitempty"` + + // Immutable. The industry vertical that the data store registers. + IndustryVertical *string `json:"industryVertical,omitempty"` + + // The solutions that the data store enrolls. Available solutions for each + // [industry_vertical][google.cloud.discoveryengine.v1.DataStore.industry_vertical]: + // + // * `MEDIA`: `SOLUTION_TYPE_RECOMMENDATION` and `SOLUTION_TYPE_SEARCH`. + // * `SITE_SEARCH`: `SOLUTION_TYPE_SEARCH` is automatically enrolled. Other + // solutions cannot be enrolled. + SolutionTypes []string `json:"solutionTypes,omitempty"` + + // Immutable. The content config of the data store. If this field is unset, + // the server behavior defaults to + // [ContentConfig.NO_CONTENT][google.cloud.discoveryengine.v1.DataStore.ContentConfig.NO_CONTENT]. + ContentConfig *string `json:"contentConfig,omitempty"` + + // Config to store data store type configuration for workspace data. This + // must be set when + // [DataStore.content_config][google.cloud.discoveryengine.v1.DataStore.content_config] + // is set as + // [DataStore.ContentConfig.GOOGLE_WORKSPACE][google.cloud.discoveryengine.v1.DataStore.ContentConfig.GOOGLE_WORKSPACE]. + WorkspaceConfig *WorkspaceConfig `json:"workspaceConfig,omitempty"` + + /* NOTYET: this includes a map[string]object which is difficult to map to KRM + // Configuration for Document understanding and enrichment. + DocumentProcessingConfig *DocumentProcessingConfig `json:"documentProcessingConfig,omitempty"` + */ + + /* The ID of the project in which the resource belongs.*/ + ProjectRef *refs.ProjectRef `json:"projectRef"` + + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Location field is immutable" + // Immutable. The location for the resource. + Location string `json:"location"` +} + +// DiscoveryEngineDataStoreStatus defines the config connector machine state of DiscoveryEngineDataStore +type DiscoveryEngineDataStoreStatus struct { + /* Conditions represent the latest available observations of the + object's current state. */ + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` + + // ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + + // A unique specifier for the DiscoveryEngineDataStore resource in GCP. + ExternalRef *string `json:"externalRef,omitempty"` + + // ObservedState is the state of the resource as most recently observed in GCP. + ObservedState *DiscoveryEngineDataStoreObservedState `json:"observedState,omitempty"` +} + +// DiscoveryEngineDataStoreObservedState is the state of the DiscoveryEngineDataStore resource as most recently observed in GCP. +// +kcc:proto=google.cloud.discoveryengine.v1.DataStore +type DiscoveryEngineDataStoreObservedState struct { + // Output only. The id of the default + // [Schema][google.cloud.discoveryengine.v1.Schema] asscociated to this data + // store. + DefaultSchemaID *string `json:"defaultSchemaID,omitempty"` + + // Output only. Timestamp the + // [DataStore][google.cloud.discoveryengine.v1.DataStore] was created at. + CreateTime *string `json:"createTime,omitempty"` + + // Output only. Data size estimation for billing. + BillingEstimation *DataStore_BillingEstimation `json:"billingEstimation,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// TODO(user): make sure the pluralizaiton below is correct +// +kubebuilder:resource:categories=gcp,shortName=gcpdiscoveryenginedatastore;gcpdiscoveryenginedatastores +// +kubebuilder:subresource:status +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true" +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" + +// DiscoveryEngineDataStore is the Schema for the DiscoveryEngineDataStore API +// +k8s:openapi-gen=true +type DiscoveryEngineDataStore struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // +required + Spec DiscoveryEngineDataStoreSpec `json:"spec,omitempty"` + Status DiscoveryEngineDataStoreStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// DiscoveryEngineDataStoreList contains a list of DiscoveryEngineDataStore +type DiscoveryEngineDataStoreList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DiscoveryEngineDataStore `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DiscoveryEngineDataStore{}, &DiscoveryEngineDataStoreList{}) +} diff --git a/apis/discoveryengine/v1alpha1/doc.go b/apis/discoveryengine/v1alpha1/doc.go new file mode 100644 index 0000000000..549203dc1a --- /dev/null +++ b/apis/discoveryengine/v1alpha1/doc.go @@ -0,0 +1,16 @@ +// 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. + +// +kcc:proto=google.cloud.discoveryengine.v1 +package v1alpha1 diff --git a/apis/discoveryengine/v1alpha1/groupversion_info.go b/apis/discoveryengine/v1alpha1/groupversion_info.go new file mode 100644 index 0000000000..b39fe0b24a --- /dev/null +++ b/apis/discoveryengine/v1alpha1/groupversion_info.go @@ -0,0 +1,33 @@ +// 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. + +// +kubebuilder:object:generate=true +// +groupName=discoveryengine.cnrm.cloud.google.com +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "discoveryengine.cnrm.cloud.google.com", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/dev/tools/controllerbuilder/generate.sh b/dev/tools/controllerbuilder/generate.sh index b972441642..6cad3883a2 100755 --- a/dev/tools/controllerbuilder/generate.sh +++ b/dev/tools/controllerbuilder/generate.sh @@ -24,6 +24,27 @@ cd ${REPO_ROOT}/dev/tools/controllerbuilder APIS_DIR=${REPO_ROOT}/apis/ OUTPUT_MAPPER=${REPO_ROOT}/pkg/controller/direct/ +# DiscoveryEngine +go run . generate-types \ + --proto-source-path ../proto-to-mapper/build/googleapis.pb \ + --service google.cloud.discoveryengine.v1 \ + --api-version discoveryengine.cnrm.cloud.google.com/v1alpha1 \ + --output-api ${APIS_DIR} \ + --kind DiscoveryEngineDataStore \ + --proto-resource DataStore + +# go run . prompt --src-dir ~/kcc/k8s-config-connector --proto-dir ~/kcc/k8s-config-connector/dev/tools/proto-to-mapper/third_party/googleapis/ < Date: Thu, 24 Oct 2024 07:54:21 -0400 Subject: [PATCH 4/8] autogen: DiscoveryEngineDataStore --- .../v1alpha1/types.generated.go | 144 +++++ .../v1alpha1/zz_generated.deepcopy.go | 506 ++++++++++++++++++ .../discoveryengine/mapper.generated.go | 280 ++++++++++ 3 files changed, 930 insertions(+) create mode 100644 apis/discoveryengine/v1alpha1/types.generated.go create mode 100644 apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go create mode 100644 pkg/controller/direct/discoveryengine/mapper.generated.go diff --git a/apis/discoveryengine/v1alpha1/types.generated.go b/apis/discoveryengine/v1alpha1/types.generated.go new file mode 100644 index 0000000000..77fd262e82 --- /dev/null +++ b/apis/discoveryengine/v1alpha1/types.generated.go @@ -0,0 +1,144 @@ +// 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 v1alpha1 + +// +kcc:proto=google.cloud.discoveryengine.v1.DataStore.BillingEstimation +type DataStore_BillingEstimation struct { + // Data size for structured data in terms of bytes. + StructuredDataSize *int64 `json:"structuredDataSize,omitempty"` + + // Data size for unstructured data in terms of bytes. + UnstructuredDataSize *int64 `json:"unstructuredDataSize,omitempty"` + + // Data size for websites in terms of bytes. + WebsiteDataSize *int64 `json:"websiteDataSize,omitempty"` + + // Last updated timestamp for structured data. + StructuredDataUpdateTime *string `json:"structuredDataUpdateTime,omitempty"` + + // Last updated timestamp for unstructured data. + UnstructuredDataUpdateTime *string `json:"unstructuredDataUpdateTime,omitempty"` + + // Last updated timestamp for websites. + WebsiteDataUpdateTime *string `json:"websiteDataUpdateTime,omitempty"` +} + +// +kcc:proto=google.cloud.discoveryengine.v1.DocumentProcessingConfig +type DocumentProcessingConfig struct { + // The full resource name of the Document Processing Config. + // Format: + // `projects/*/locations/*/collections/*/dataStores/*/documentProcessingConfig`. + Name *string `json:"name,omitempty"` + + // Whether chunking mode is enabled. + ChunkingConfig *DocumentProcessingConfig_ChunkingConfig `json:"chunkingConfig,omitempty"` + + // Configurations for default Document parser. + // If not specified, we will configure it as default DigitalParsingConfig, and + // the default parsing config will be applied to all file types for Document + // parsing. + DefaultParsingConfig *DocumentProcessingConfig_ParsingConfig `json:"defaultParsingConfig,omitempty"` + + // TODO: map type string message for parsing_config_overrides + +} + +// +kcc:proto=google.cloud.discoveryengine.v1.DocumentProcessingConfig.ChunkingConfig +type DocumentProcessingConfig_ChunkingConfig struct { + // Configuration for the layout based chunking. + LayoutBasedChunkingConfig *DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig `json:"layoutBasedChunkingConfig,omitempty"` +} + +// +kcc:proto=google.cloud.discoveryengine.v1.DocumentProcessingConfig.ChunkingConfig.LayoutBasedChunkingConfig +type DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig struct { + // The token size limit for each chunk. + // + // Supported values: 100-500 (inclusive). + // Default value: 500. + ChunkSize *int32 `json:"chunkSize,omitempty"` + + // Whether to include appending different levels of headings to chunks + // from the middle of the document to prevent context loss. + // + // Default value: False. + IncludeAncestorHeadings *bool `json:"includeAncestorHeadings,omitempty"` +} + +// +kcc:proto=google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig +type DocumentProcessingConfig_ParsingConfig struct { + // Configurations applied to digital parser. + DigitalParsingConfig *DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig `json:"digitalParsingConfig,omitempty"` + + // Configurations applied to OCR parser. Currently it only applies to + // PDFs. + OcrParsingConfig *DocumentProcessingConfig_ParsingConfig_OcrParsingConfig `json:"ocrParsingConfig,omitempty"` + + // Configurations applied to layout parser. + LayoutParsingConfig *DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig `json:"layoutParsingConfig,omitempty"` +} + +// +kcc:proto=google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.DigitalParsingConfig +type DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig struct { +} + +// +kcc:proto=google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.LayoutParsingConfig +type DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig struct { +} + +// +kcc:proto=google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.OcrParsingConfig +type DocumentProcessingConfig_ParsingConfig_OcrParsingConfig struct { + // [DEPRECATED] This field is deprecated. To use the additional enhanced + // document elements processing, please switch to `layout_parsing_config`. + EnhancedDocumentElements []string `json:"enhancedDocumentElements,omitempty"` + + // If true, will use native text instead of OCR text on pages containing + // native text. + UseNativeText *bool `json:"useNativeText,omitempty"` +} + +// +kcc:proto=google.cloud.discoveryengine.v1.Schema +type Schema struct { + // The structured representation of the schema. + StructSchema map[string]string `json:"structSchema,omitempty"` + + // The JSON representation of the schema. + JsonSchema *string `json:"jsonSchema,omitempty"` + + // Immutable. The full resource name of the schema, in the format of + // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`. + // + // This field must be a UTF-8 encoded string with a length limit of 1024 + // characters. + Name *string `json:"name,omitempty"` +} + +// +kcc:proto=google.cloud.discoveryengine.v1.WorkspaceConfig +type WorkspaceConfig struct { + // The Google Workspace data source. + Type *string `json:"type,omitempty"` + + // Obfuscated Dasher customer ID. + DasherCustomerID *string `json:"dasherCustomerID,omitempty"` + + // Optional. The super admin service account for the workspace that will be + // used for access token generation. For now we only use it for Native Google + // Drive connector data ingestion. + SuperAdminServiceAccount *string `json:"superAdminServiceAccount,omitempty"` + + // Optional. The super admin email address for the workspace that will be used + // for access token generation. For now we only use it for Native Google Drive + // connector data ingestion. + SuperAdminEmailAddress *string `json:"superAdminEmailAddress,omitempty"` +} diff --git a/apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go b/apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..f881ca6a1f --- /dev/null +++ b/apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,506 @@ +//go:build !ignore_autogenerated + +// Copyright 2020 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. + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" + k8sv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataStore_BillingEstimation) DeepCopyInto(out *DataStore_BillingEstimation) { + *out = *in + if in.StructuredDataSize != nil { + in, out := &in.StructuredDataSize, &out.StructuredDataSize + *out = new(int64) + **out = **in + } + if in.UnstructuredDataSize != nil { + in, out := &in.UnstructuredDataSize, &out.UnstructuredDataSize + *out = new(int64) + **out = **in + } + if in.WebsiteDataSize != nil { + in, out := &in.WebsiteDataSize, &out.WebsiteDataSize + *out = new(int64) + **out = **in + } + if in.StructuredDataUpdateTime != nil { + in, out := &in.StructuredDataUpdateTime, &out.StructuredDataUpdateTime + *out = new(string) + **out = **in + } + if in.UnstructuredDataUpdateTime != nil { + in, out := &in.UnstructuredDataUpdateTime, &out.UnstructuredDataUpdateTime + *out = new(string) + **out = **in + } + if in.WebsiteDataUpdateTime != nil { + in, out := &in.WebsiteDataUpdateTime, &out.WebsiteDataUpdateTime + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataStore_BillingEstimation. +func (in *DataStore_BillingEstimation) DeepCopy() *DataStore_BillingEstimation { + if in == nil { + return nil + } + out := new(DataStore_BillingEstimation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStore) DeepCopyInto(out *DiscoveryEngineDataStore) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStore. +func (in *DiscoveryEngineDataStore) DeepCopy() *DiscoveryEngineDataStore { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DiscoveryEngineDataStore) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreList) DeepCopyInto(out *DiscoveryEngineDataStoreList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DiscoveryEngineDataStore, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreList. +func (in *DiscoveryEngineDataStoreList) DeepCopy() *DiscoveryEngineDataStoreList { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DiscoveryEngineDataStoreList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreObservedState) DeepCopyInto(out *DiscoveryEngineDataStoreObservedState) { + *out = *in + if in.DefaultSchemaID != nil { + in, out := &in.DefaultSchemaID, &out.DefaultSchemaID + *out = new(string) + **out = **in + } + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = new(string) + **out = **in + } + if in.BillingEstimation != nil { + in, out := &in.BillingEstimation, &out.BillingEstimation + *out = new(DataStore_BillingEstimation) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreObservedState. +func (in *DiscoveryEngineDataStoreObservedState) DeepCopy() *DiscoveryEngineDataStoreObservedState { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreObservedState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreParent) DeepCopyInto(out *DiscoveryEngineDataStoreParent) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreParent. +func (in *DiscoveryEngineDataStoreParent) DeepCopy() *DiscoveryEngineDataStoreParent { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreParent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreRef) DeepCopyInto(out *DiscoveryEngineDataStoreRef) { + *out = *in + if in.parent != nil { + in, out := &in.parent, &out.parent + *out = new(DiscoveryEngineDataStoreParent) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreRef. +func (in *DiscoveryEngineDataStoreRef) DeepCopy() *DiscoveryEngineDataStoreRef { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreSpec) DeepCopyInto(out *DiscoveryEngineDataStoreSpec) { + *out = *in + if in.ResourceID != nil { + in, out := &in.ResourceID, &out.ResourceID + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.IndustryVertical != nil { + in, out := &in.IndustryVertical, &out.IndustryVertical + *out = new(string) + **out = **in + } + if in.SolutionTypes != nil { + in, out := &in.SolutionTypes, &out.SolutionTypes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ContentConfig != nil { + in, out := &in.ContentConfig, &out.ContentConfig + *out = new(string) + **out = **in + } + if in.WorkspaceConfig != nil { + in, out := &in.WorkspaceConfig, &out.WorkspaceConfig + *out = new(WorkspaceConfig) + (*in).DeepCopyInto(*out) + } + if in.ProjectRef != nil { + in, out := &in.ProjectRef, &out.ProjectRef + *out = new(v1beta1.ProjectRef) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreSpec. +func (in *DiscoveryEngineDataStoreSpec) DeepCopy() *DiscoveryEngineDataStoreSpec { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreStatus) DeepCopyInto(out *DiscoveryEngineDataStoreStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]k8sv1alpha1.Condition, len(*in)) + copy(*out, *in) + } + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int64) + **out = **in + } + if in.ExternalRef != nil { + in, out := &in.ExternalRef, &out.ExternalRef + *out = new(string) + **out = **in + } + if in.ObservedState != nil { + in, out := &in.ObservedState, &out.ObservedState + *out = new(DiscoveryEngineDataStoreObservedState) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreStatus. +func (in *DiscoveryEngineDataStoreStatus) DeepCopy() *DiscoveryEngineDataStoreStatus { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DocumentProcessingConfig) DeepCopyInto(out *DocumentProcessingConfig) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.ChunkingConfig != nil { + in, out := &in.ChunkingConfig, &out.ChunkingConfig + *out = new(DocumentProcessingConfig_ChunkingConfig) + (*in).DeepCopyInto(*out) + } + if in.DefaultParsingConfig != nil { + in, out := &in.DefaultParsingConfig, &out.DefaultParsingConfig + *out = new(DocumentProcessingConfig_ParsingConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DocumentProcessingConfig. +func (in *DocumentProcessingConfig) DeepCopy() *DocumentProcessingConfig { + if in == nil { + return nil + } + out := new(DocumentProcessingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DocumentProcessingConfig_ChunkingConfig) DeepCopyInto(out *DocumentProcessingConfig_ChunkingConfig) { + *out = *in + if in.LayoutBasedChunkingConfig != nil { + in, out := &in.LayoutBasedChunkingConfig, &out.LayoutBasedChunkingConfig + *out = new(DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DocumentProcessingConfig_ChunkingConfig. +func (in *DocumentProcessingConfig_ChunkingConfig) DeepCopy() *DocumentProcessingConfig_ChunkingConfig { + if in == nil { + return nil + } + out := new(DocumentProcessingConfig_ChunkingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig) DeepCopyInto(out *DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig) { + *out = *in + if in.ChunkSize != nil { + in, out := &in.ChunkSize, &out.ChunkSize + *out = new(int32) + **out = **in + } + if in.IncludeAncestorHeadings != nil { + in, out := &in.IncludeAncestorHeadings, &out.IncludeAncestorHeadings + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig. +func (in *DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig) DeepCopy() *DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig { + if in == nil { + return nil + } + out := new(DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DocumentProcessingConfig_ParsingConfig) DeepCopyInto(out *DocumentProcessingConfig_ParsingConfig) { + *out = *in + if in.DigitalParsingConfig != nil { + in, out := &in.DigitalParsingConfig, &out.DigitalParsingConfig + *out = new(DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig) + **out = **in + } + if in.OcrParsingConfig != nil { + in, out := &in.OcrParsingConfig, &out.OcrParsingConfig + *out = new(DocumentProcessingConfig_ParsingConfig_OcrParsingConfig) + (*in).DeepCopyInto(*out) + } + if in.LayoutParsingConfig != nil { + in, out := &in.LayoutParsingConfig, &out.LayoutParsingConfig + *out = new(DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DocumentProcessingConfig_ParsingConfig. +func (in *DocumentProcessingConfig_ParsingConfig) DeepCopy() *DocumentProcessingConfig_ParsingConfig { + if in == nil { + return nil + } + out := new(DocumentProcessingConfig_ParsingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig) DeepCopyInto(out *DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig. +func (in *DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig) DeepCopy() *DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig { + if in == nil { + return nil + } + out := new(DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig) DeepCopyInto(out *DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig. +func (in *DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig) DeepCopy() *DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig { + if in == nil { + return nil + } + out := new(DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DocumentProcessingConfig_ParsingConfig_OcrParsingConfig) DeepCopyInto(out *DocumentProcessingConfig_ParsingConfig_OcrParsingConfig) { + *out = *in + if in.EnhancedDocumentElements != nil { + in, out := &in.EnhancedDocumentElements, &out.EnhancedDocumentElements + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.UseNativeText != nil { + in, out := &in.UseNativeText, &out.UseNativeText + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DocumentProcessingConfig_ParsingConfig_OcrParsingConfig. +func (in *DocumentProcessingConfig_ParsingConfig_OcrParsingConfig) DeepCopy() *DocumentProcessingConfig_ParsingConfig_OcrParsingConfig { + if in == nil { + return nil + } + out := new(DocumentProcessingConfig_ParsingConfig_OcrParsingConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Schema) DeepCopyInto(out *Schema) { + *out = *in + if in.StructSchema != nil { + in, out := &in.StructSchema, &out.StructSchema + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.JsonSchema != nil { + in, out := &in.JsonSchema, &out.JsonSchema + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Schema. +func (in *Schema) DeepCopy() *Schema { + if in == nil { + return nil + } + out := new(Schema) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkspaceConfig) DeepCopyInto(out *WorkspaceConfig) { + *out = *in + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.DasherCustomerID != nil { + in, out := &in.DasherCustomerID, &out.DasherCustomerID + *out = new(string) + **out = **in + } + if in.SuperAdminServiceAccount != nil { + in, out := &in.SuperAdminServiceAccount, &out.SuperAdminServiceAccount + *out = new(string) + **out = **in + } + if in.SuperAdminEmailAddress != nil { + in, out := &in.SuperAdminEmailAddress, &out.SuperAdminEmailAddress + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceConfig. +func (in *WorkspaceConfig) DeepCopy() *WorkspaceConfig { + if in == nil { + return nil + } + out := new(WorkspaceConfig) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/controller/direct/discoveryengine/mapper.generated.go b/pkg/controller/direct/discoveryengine/mapper.generated.go new file mode 100644 index 0000000000..683842a169 --- /dev/null +++ b/pkg/controller/direct/discoveryengine/mapper.generated.go @@ -0,0 +1,280 @@ +// 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 discoveryengine + +import ( + pb "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb" + krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/discoveryengine/v1alpha1" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct" +) + +func DataStore_BillingEstimation_FromProto(mapCtx *direct.MapContext, in *pb.DataStore_BillingEstimation) *krm.DataStore_BillingEstimation { + if in == nil { + return nil + } + out := &krm.DataStore_BillingEstimation{} + out.StructuredDataSize = direct.LazyPtr(in.GetStructuredDataSize()) + out.UnstructuredDataSize = direct.LazyPtr(in.GetUnstructuredDataSize()) + out.WebsiteDataSize = direct.LazyPtr(in.GetWebsiteDataSize()) + out.StructuredDataUpdateTime = direct.StringTimestamp_FromProto(mapCtx, in.GetStructuredDataUpdateTime()) + out.UnstructuredDataUpdateTime = direct.StringTimestamp_FromProto(mapCtx, in.GetUnstructuredDataUpdateTime()) + out.WebsiteDataUpdateTime = direct.StringTimestamp_FromProto(mapCtx, in.GetWebsiteDataUpdateTime()) + return out +} +func DataStore_BillingEstimation_ToProto(mapCtx *direct.MapContext, in *krm.DataStore_BillingEstimation) *pb.DataStore_BillingEstimation { + if in == nil { + return nil + } + out := &pb.DataStore_BillingEstimation{} + out.StructuredDataSize = direct.ValueOf(in.StructuredDataSize) + out.UnstructuredDataSize = direct.ValueOf(in.UnstructuredDataSize) + out.WebsiteDataSize = direct.ValueOf(in.WebsiteDataSize) + out.StructuredDataUpdateTime = direct.StringTimestamp_ToProto(mapCtx, in.StructuredDataUpdateTime) + out.UnstructuredDataUpdateTime = direct.StringTimestamp_ToProto(mapCtx, in.UnstructuredDataUpdateTime) + out.WebsiteDataUpdateTime = direct.StringTimestamp_ToProto(mapCtx, in.WebsiteDataUpdateTime) + return out +} +func DiscoveryEngineDataStoreObservedState_FromProto(mapCtx *direct.MapContext, in *pb.DataStore) *krm.DiscoveryEngineDataStoreObservedState { + if in == nil { + return nil + } + out := &krm.DiscoveryEngineDataStoreObservedState{} + // MISSING: Name + out.DefaultSchemaID = direct.LazyPtr(in.GetDefaultSchemaId()) + out.CreateTime = direct.StringTimestamp_FromProto(mapCtx, in.GetCreateTime()) + out.BillingEstimation = DataStore_BillingEstimation_FromProto(mapCtx, in.GetBillingEstimation()) + // MISSING: DocumentProcessingConfig + // MISSING: StartingSchema + return out +} +func DiscoveryEngineDataStoreObservedState_ToProto(mapCtx *direct.MapContext, in *krm.DiscoveryEngineDataStoreObservedState) *pb.DataStore { + if in == nil { + return nil + } + out := &pb.DataStore{} + // MISSING: Name + out.DefaultSchemaId = direct.ValueOf(in.DefaultSchemaID) + out.CreateTime = direct.StringTimestamp_ToProto(mapCtx, in.CreateTime) + out.BillingEstimation = DataStore_BillingEstimation_ToProto(mapCtx, in.BillingEstimation) + // MISSING: DocumentProcessingConfig + // MISSING: StartingSchema + return out +} +func DiscoveryEngineDataStoreSpec_FromProto(mapCtx *direct.MapContext, in *pb.DataStore) *krm.DiscoveryEngineDataStoreSpec { + if in == nil { + return nil + } + out := &krm.DiscoveryEngineDataStoreSpec{} + // MISSING: Name + out.DisplayName = direct.LazyPtr(in.GetDisplayName()) + out.IndustryVertical = direct.Enum_FromProto(mapCtx, in.GetIndustryVertical()) + out.SolutionTypes = direct.EnumSlice_FromProto(mapCtx, in.SolutionTypes) + out.ContentConfig = direct.Enum_FromProto(mapCtx, in.GetContentConfig()) + out.WorkspaceConfig = WorkspaceConfig_FromProto(mapCtx, in.GetWorkspaceConfig()) + // MISSING: DocumentProcessingConfig + // MISSING: StartingSchema + return out +} +func DiscoveryEngineDataStoreSpec_ToProto(mapCtx *direct.MapContext, in *krm.DiscoveryEngineDataStoreSpec) *pb.DataStore { + if in == nil { + return nil + } + out := &pb.DataStore{} + // MISSING: Name + out.DisplayName = direct.ValueOf(in.DisplayName) + out.IndustryVertical = direct.Enum_ToProto[pb.IndustryVertical](mapCtx, in.IndustryVertical) + out.SolutionTypes = direct.EnumSlice_ToProto[pb.SolutionType](mapCtx, in.SolutionTypes) + out.ContentConfig = direct.Enum_ToProto[pb.DataStore_ContentConfig](mapCtx, in.ContentConfig) + out.WorkspaceConfig = WorkspaceConfig_ToProto(mapCtx, in.WorkspaceConfig) + // MISSING: DocumentProcessingConfig + // MISSING: StartingSchema + return out +} +func DocumentProcessingConfig_FromProto(mapCtx *direct.MapContext, in *pb.DocumentProcessingConfig) *krm.DocumentProcessingConfig { + if in == nil { + return nil + } + out := &krm.DocumentProcessingConfig{} + out.Name = direct.LazyPtr(in.GetName()) + out.ChunkingConfig = DocumentProcessingConfig_ChunkingConfig_FromProto(mapCtx, in.GetChunkingConfig()) + out.DefaultParsingConfig = DocumentProcessingConfig_ParsingConfig_FromProto(mapCtx, in.GetDefaultParsingConfig()) + // MISSING: ParsingConfigOverrides + return out +} +func DocumentProcessingConfig_ToProto(mapCtx *direct.MapContext, in *krm.DocumentProcessingConfig) *pb.DocumentProcessingConfig { + if in == nil { + return nil + } + out := &pb.DocumentProcessingConfig{} + out.Name = direct.ValueOf(in.Name) + out.ChunkingConfig = DocumentProcessingConfig_ChunkingConfig_ToProto(mapCtx, in.ChunkingConfig) + out.DefaultParsingConfig = DocumentProcessingConfig_ParsingConfig_ToProto(mapCtx, in.DefaultParsingConfig) + // MISSING: ParsingConfigOverrides + return out +} +func DocumentProcessingConfig_ChunkingConfig_FromProto(mapCtx *direct.MapContext, in *pb.DocumentProcessingConfig_ChunkingConfig) *krm.DocumentProcessingConfig_ChunkingConfig { + if in == nil { + return nil + } + out := &krm.DocumentProcessingConfig_ChunkingConfig{} + out.LayoutBasedChunkingConfig = DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig_FromProto(mapCtx, in.GetLayoutBasedChunkingConfig()) + return out +} +func DocumentProcessingConfig_ChunkingConfig_ToProto(mapCtx *direct.MapContext, in *krm.DocumentProcessingConfig_ChunkingConfig) *pb.DocumentProcessingConfig_ChunkingConfig { + if in == nil { + return nil + } + out := &pb.DocumentProcessingConfig_ChunkingConfig{} + if oneof := DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig_ToProto(mapCtx, in.LayoutBasedChunkingConfig); oneof != nil { + out.ChunkMode = &pb.DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig_{LayoutBasedChunkingConfig: oneof} + } + return out +} +func DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig_FromProto(mapCtx *direct.MapContext, in *pb.DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig) *krm.DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig { + if in == nil { + return nil + } + out := &krm.DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig{} + out.ChunkSize = direct.LazyPtr(in.GetChunkSize()) + out.IncludeAncestorHeadings = direct.LazyPtr(in.GetIncludeAncestorHeadings()) + return out +} +func DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig_ToProto(mapCtx *direct.MapContext, in *krm.DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig) *pb.DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig { + if in == nil { + return nil + } + out := &pb.DocumentProcessingConfig_ChunkingConfig_LayoutBasedChunkingConfig{} + out.ChunkSize = direct.ValueOf(in.ChunkSize) + out.IncludeAncestorHeadings = direct.ValueOf(in.IncludeAncestorHeadings) + return out +} +func DocumentProcessingConfig_ParsingConfig_FromProto(mapCtx *direct.MapContext, in *pb.DocumentProcessingConfig_ParsingConfig) *krm.DocumentProcessingConfig_ParsingConfig { + if in == nil { + return nil + } + out := &krm.DocumentProcessingConfig_ParsingConfig{} + out.DigitalParsingConfig = DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig_FromProto(mapCtx, in.GetDigitalParsingConfig()) + out.OcrParsingConfig = DocumentProcessingConfig_ParsingConfig_OcrParsingConfig_FromProto(mapCtx, in.GetOcrParsingConfig()) + out.LayoutParsingConfig = DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig_FromProto(mapCtx, in.GetLayoutParsingConfig()) + return out +} +func DocumentProcessingConfig_ParsingConfig_ToProto(mapCtx *direct.MapContext, in *krm.DocumentProcessingConfig_ParsingConfig) *pb.DocumentProcessingConfig_ParsingConfig { + if in == nil { + return nil + } + out := &pb.DocumentProcessingConfig_ParsingConfig{} + if oneof := DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig_ToProto(mapCtx, in.DigitalParsingConfig); oneof != nil { + out.TypeDedicatedConfig = &pb.DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig_{DigitalParsingConfig: oneof} + } + if oneof := DocumentProcessingConfig_ParsingConfig_OcrParsingConfig_ToProto(mapCtx, in.OcrParsingConfig); oneof != nil { + out.TypeDedicatedConfig = &pb.DocumentProcessingConfig_ParsingConfig_OcrParsingConfig_{OcrParsingConfig: oneof} + } + if oneof := DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig_ToProto(mapCtx, in.LayoutParsingConfig); oneof != nil { + out.TypeDedicatedConfig = &pb.DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig_{LayoutParsingConfig: oneof} + } + return out +} +func DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig_FromProto(mapCtx *direct.MapContext, in *pb.DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig) *krm.DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig { + if in == nil { + return nil + } + out := &krm.DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig{} + return out +} +func DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig_ToProto(mapCtx *direct.MapContext, in *krm.DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig) *pb.DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig { + if in == nil { + return nil + } + out := &pb.DocumentProcessingConfig_ParsingConfig_DigitalParsingConfig{} + return out +} +func DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig_FromProto(mapCtx *direct.MapContext, in *pb.DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig) *krm.DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig { + if in == nil { + return nil + } + out := &krm.DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig{} + return out +} +func DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig_ToProto(mapCtx *direct.MapContext, in *krm.DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig) *pb.DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig { + if in == nil { + return nil + } + out := &pb.DocumentProcessingConfig_ParsingConfig_LayoutParsingConfig{} + return out +} +func DocumentProcessingConfig_ParsingConfig_OcrParsingConfig_FromProto(mapCtx *direct.MapContext, in *pb.DocumentProcessingConfig_ParsingConfig_OcrParsingConfig) *krm.DocumentProcessingConfig_ParsingConfig_OcrParsingConfig { + if in == nil { + return nil + } + out := &krm.DocumentProcessingConfig_ParsingConfig_OcrParsingConfig{} + out.EnhancedDocumentElements = in.EnhancedDocumentElements + out.UseNativeText = direct.LazyPtr(in.GetUseNativeText()) + return out +} +func DocumentProcessingConfig_ParsingConfig_OcrParsingConfig_ToProto(mapCtx *direct.MapContext, in *krm.DocumentProcessingConfig_ParsingConfig_OcrParsingConfig) *pb.DocumentProcessingConfig_ParsingConfig_OcrParsingConfig { + if in == nil { + return nil + } + out := &pb.DocumentProcessingConfig_ParsingConfig_OcrParsingConfig{} + out.EnhancedDocumentElements = in.EnhancedDocumentElements + out.UseNativeText = direct.ValueOf(in.UseNativeText) + return out +} +func Schema_FromProto(mapCtx *direct.MapContext, in *pb.Schema) *krm.Schema { + if in == nil { + return nil + } + out := &krm.Schema{} + out.StructSchema = StructSchema_FromProto(mapCtx, in.GetStructSchema()) + out.JsonSchema = direct.LazyPtr(in.GetJsonSchema()) + out.Name = direct.LazyPtr(in.GetName()) + return out +} +func Schema_ToProto(mapCtx *direct.MapContext, in *krm.Schema) *pb.Schema { + if in == nil { + return nil + } + out := &pb.Schema{} + if oneof := StructSchema_ToProto(mapCtx, in.StructSchema); oneof != nil { + out.Schema = &pb.Schema_StructSchema{StructSchema: oneof} + } + if oneof := Schema_JsonSchema_ToProto(mapCtx, in.JsonSchema); oneof != nil { + out.Schema = oneof + } + out.Name = direct.ValueOf(in.Name) + return out +} +func WorkspaceConfig_FromProto(mapCtx *direct.MapContext, in *pb.WorkspaceConfig) *krm.WorkspaceConfig { + if in == nil { + return nil + } + out := &krm.WorkspaceConfig{} + out.Type = direct.Enum_FromProto(mapCtx, in.GetType()) + out.DasherCustomerID = direct.LazyPtr(in.GetDasherCustomerId()) + out.SuperAdminServiceAccount = direct.LazyPtr(in.GetSuperAdminServiceAccount()) + out.SuperAdminEmailAddress = direct.LazyPtr(in.GetSuperAdminEmailAddress()) + return out +} +func WorkspaceConfig_ToProto(mapCtx *direct.MapContext, in *krm.WorkspaceConfig) *pb.WorkspaceConfig { + if in == nil { + return nil + } + out := &pb.WorkspaceConfig{} + out.Type = direct.Enum_ToProto[pb.WorkspaceConfig_Type](mapCtx, in.Type) + out.DasherCustomerId = direct.ValueOf(in.DasherCustomerID) + out.SuperAdminServiceAccount = direct.ValueOf(in.SuperAdminServiceAccount) + out.SuperAdminEmailAddress = direct.ValueOf(in.SuperAdminEmailAddress) + return out +} From 3e36b02e3033c7d42cb867c82e3daf1349426b6f Mon Sep 17 00:00:00 2001 From: justinsb Date: Thu, 24 Oct 2024 09:34:02 -0400 Subject: [PATCH 5/8] DiscoveryEngineDataStore: fuzzers --- .../direct/discoveryengine/fuzzers.go | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 pkg/controller/direct/discoveryengine/fuzzers.go diff --git a/pkg/controller/direct/discoveryengine/fuzzers.go b/pkg/controller/direct/discoveryengine/fuzzers.go new file mode 100644 index 0000000000..6e03fb8a5f --- /dev/null +++ b/pkg/controller/direct/discoveryengine/fuzzers.go @@ -0,0 +1,47 @@ +// 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 discoveryengine + +import ( + pb "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/fuzztesting" +) + +func init() { + fuzztesting.RegisterKRMFuzzer(fuzzDataStore()) +} + +func fuzzDataStore() fuzztesting.KRMFuzzer { + f := fuzztesting.NewKRMTypedFuzzer(&pb.DataStore{}, + DiscoveryEngineDataStoreSpec_FromProto, DiscoveryEngineDataStoreSpec_ToProto, + DiscoveryEngineDataStoreObservedState_FromProto, DiscoveryEngineDataStoreObservedState_ToProto, + ) + + f.UnimplementedFields.Insert(".name") // special field + f.UnimplementedFields.Insert(".document_processing_config") // complex map[string]object, so not implementing yet + f.UnimplementedFields.Insert(".starting_schema") // Tricky field, only on create + + f.SpecFields.Insert(".display_name") + f.SpecFields.Insert(".industry_vertical") + f.SpecFields.Insert(".solution_types") + f.SpecFields.Insert(".content_config") + f.SpecFields.Insert(".workspace_config") + + f.StatusFields.Insert(".default_schema_id") + f.StatusFields.Insert(".create_time") + f.StatusFields.Insert(".billing_estimation") + + return f +} From 2837e0eb40729e67a1624c9a6e3501fa6baf7e8e Mon Sep 17 00:00:00 2001 From: justinsb Date: Thu, 24 Oct 2024 09:53:24 -0400 Subject: [PATCH 6/8] fuzzers: handle more types in visitor --- pkg/test/fuzz/generate.go | 41 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/pkg/test/fuzz/generate.go b/pkg/test/fuzz/generate.go index bf21da133d..c4f3ab5822 100644 --- a/pkg/test/fuzz/generate.go +++ b/pkg/test/fuzz/generate.go @@ -118,9 +118,20 @@ func fillWithRandom0(t *testing.T, randStream *rand.Rand, msg protoreflect.Messa case "string->message": if field.FullName() == "google.protobuf.Struct.fields" && field.MapValue().Message().FullName() == "google.protobuf.Value" { // currently this is converted to "map[string]string" in "BigQueryDataTransferConfig" - // TODO: fill in random strings + mapVal := msg.Mutable(field).Map() + for j := 0; j < count; j++ { + k := randomString(randStream) + v := randomString(randStream) + el := mapVal.Mutable(protoreflect.ValueOf(k).MapKey()).Message() + el.Set(el.Descriptor().Fields().ByName("string_value"), protoreflect.ValueOfString(v)) + } } else { - t.Fatalf("unhandled case for map kind %q: %v", mapType, field) + mapVal := msg.Mutable(field).Map() + for j := 0; j < count; j++ { + k := randomString(randStream) + el := mapVal.Mutable(protoreflect.ValueOf(k).MapKey()) + fillWithRandom0(t, randStream, el.Message()) + } } default: @@ -323,9 +334,33 @@ func Visit(msgPath string, msg protoreflect.Message, setter func(v protoreflect. visitor.VisitPrimitive(mapPath, val, setter) return true }) + case "string->message": + mapVal := msg.Mutable(field).Map() + setter := func(v protoreflect.Value) { + if v.IsValid() { + msg.Set(field, v) + } else { + msg.Clear(field) + } + } + visitor.VisitMap(path, mapVal, setter) + + // In case the value changes + mapVal = msg.Mutable(field).Map() + mapVal.Range(func(k protoreflect.MapKey, val protoreflect.Value) bool { + mapPath := path + "[" + k.String() + "]" + setter := func(v protoreflect.Value) { + mapVal.Set(k, v) + } + + v := mapVal.Get(k) + Visit(mapPath, v.Message(), setter, visitor) + + return true + }) default: - klog.Fatalf("unhandled map kind %q: %v", mapType, field) + klog.Fatalf("unhandled map kind in visitor %q: %v", mapType, field) } return true } From 0f0cbaf417beca9fedfd5ae99b63f8093f4010f5 Mon Sep 17 00:00:00 2001 From: justinsb Date: Thu, 24 Oct 2024 09:54:38 -0400 Subject: [PATCH 7/8] DiscoveryEngineDataStore: update go.mod / go.sum --- go.mod | 1 + go.sum | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 20eec92c50..36c7d6e458 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( cloud.google.com/go/compute v1.28.1 cloud.google.com/go/dataflow v0.10.1 cloud.google.com/go/dataform v0.10.1 + cloud.google.com/go/discoveryengine v1.15.0 cloud.google.com/go/firestore v1.17.0 cloud.google.com/go/gkemulticloud v1.4.0 cloud.google.com/go/iam v1.2.1 diff --git a/go.sum b/go.sum index e30c46ab85..df548b3821 100644 --- a/go.sum +++ b/go.sum @@ -56,6 +56,8 @@ cloud.google.com/go/dataform v0.10.1 h1:FkOPrxf8sN9J2TMc4CIBhVivhMiO8D0eYN33s5A5 cloud.google.com/go/dataform v0.10.1/go.mod h1:c5y0hIOBCfszmBcLJyxnELF30gC1qC/NeHdmkzA7TNQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/discoveryengine v1.15.0 h1:CHUN1mbs5iTqWJRuU6rZCvcuV5iVMr/rW8Kr1ivn7p4= +cloud.google.com/go/discoveryengine v1.15.0/go.mod h1:WIstQLougDQ6D8cza4icHFfGGzXsI4QNwTEWdNfRJ8g= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/kms v1.20.0 h1:uKUvjGqbBlI96xGE669hcVnEMw1Px/Mvfa62dhM5UrY= cloud.google.com/go/kms v1.20.0/go.mod h1:/dMbFF1tLLFnQV44AoI2GlotbjowyUfgVwezxW291fM= From 5371b3eb461b199547ff22354b4b2fbaf9bfaf21 Mon Sep 17 00:00:00 2001 From: justinsb Date: Thu, 24 Oct 2024 18:45:27 -0400 Subject: [PATCH 8/8] DiscoveryEngineDataStore: autogen with `make ready-pr` --- ...discoveryengine.cnrm.cloud.google.com.yaml | 248 +++++++++++++++ .../components/clusterroles/cnrm_admin.yaml | 12 + .../components/clusterroles/cnrm_viewer.yaml | 8 + .../generated/apis/discoveryengine/group.go | 32 ++ .../discoveryenginedatastore_types.go | 184 +++++++++++ .../apis/discoveryengine/v1alpha1/doc.go | 38 +++ .../apis/discoveryengine/v1alpha1/register.go | 63 ++++ .../v1alpha1/zz_generated.deepcopy.go | 287 ++++++++++++++++++ .../client/clientset/versioned/clientset.go | 13 + .../versioned/fake/clientset_generated.go | 7 + .../clientset/versioned/fake/register.go | 2 + .../clientset/versioned/scheme/register.go | 2 + .../v1alpha1/discoveryengine_client.go | 110 +++++++ .../v1alpha1/discoveryenginedatastore.go | 198 ++++++++++++ .../typed/discoveryengine/v1alpha1/doc.go | 23 ++ .../discoveryengine/v1alpha1/fake/doc.go | 23 ++ .../fake/fake_discoveryengine_client.go | 43 +++ .../fake/fake_discoveryenginedatastore.go | 144 +++++++++ .../v1alpha1/generated_expansion.go | 24 ++ pkg/gvks/supportedgvks/gvks_generated.go | 10 + 20 files changed, 1471 insertions(+) create mode 100644 config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_discoveryenginedatastores.discoveryengine.cnrm.cloud.google.com.yaml create mode 100644 pkg/clients/generated/apis/discoveryengine/group.go create mode 100644 pkg/clients/generated/apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go create mode 100644 pkg/clients/generated/apis/discoveryengine/v1alpha1/doc.go create mode 100644 pkg/clients/generated/apis/discoveryengine/v1alpha1/register.go create mode 100644 pkg/clients/generated/apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go create mode 100644 pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryengine_client.go create mode 100644 pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryenginedatastore.go create mode 100644 pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/doc.go create mode 100644 pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/doc.go create mode 100644 pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryengine_client.go create mode 100644 pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryenginedatastore.go create mode 100644 pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/generated_expansion.go diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_discoveryenginedatastores.discoveryengine.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_discoveryenginedatastores.discoveryengine.cnrm.cloud.google.com.yaml new file mode 100644 index 0000000000..e40eaa2775 --- /dev/null +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_discoveryenginedatastores.discoveryengine.cnrm.cloud.google.com.yaml @@ -0,0 +1,248 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cnrm.cloud.google.com/version: 0.0.0-dev + creationTimestamp: null + labels: + cnrm.cloud.google.com/managed-by-kcc: "true" + cnrm.cloud.google.com/system: "true" + name: discoveryenginedatastores.discoveryengine.cnrm.cloud.google.com +spec: + group: discoveryengine.cnrm.cloud.google.com + names: + categories: + - gcp + kind: DiscoveryEngineDataStore + listKind: DiscoveryEngineDataStoreList + plural: discoveryenginedatastores + shortNames: + - gcpdiscoveryenginedatastore + - gcpdiscoveryenginedatastores + singular: discoveryenginedatastore + preserveUnknownFields: false + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: When 'True', the most recent reconcile of the resource succeeded + jsonPath: .status.conditions[?(@.type=='Ready')].status + name: Ready + type: string + - description: The reason for the value in 'Ready' + jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Status + type: string + - description: The last transition time for the value in 'Status' + jsonPath: .status.conditions[?(@.type=='Ready')].lastTransitionTime + name: Status Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: DiscoveryEngineDataStore is the Schema for the DiscoveryEngineDataStore + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: DiscoveryEngineDataStoreSpec defines the desired state of + DiscoveryEngineDataStore + properties: + contentConfig: + description: Immutable. The content config of the data store. If this + field is unset, the server behavior defaults to [ContentConfig.NO_CONTENT][google.cloud.discoveryengine.v1.DataStore.ContentConfig.NO_CONTENT]. + type: string + displayName: + description: |- + Required. The data store display name. + + This field must be a UTF-8 encoded string with a length limit of 128 + characters. Otherwise, an INVALID_ARGUMENT error is returned. + type: string + industryVertical: + description: Immutable. The industry vertical that the data store + registers. + type: string + location: + description: Immutable. The location for the resource. + type: string + x-kubernetes-validations: + - message: Location field is immutable + rule: self == oldSelf + projectRef: + description: The ID of the project in which the resource belongs. + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: The `projectID` field of a project, when not managed + by Config Connector. + type: string + kind: + description: The kind of the Project resource; optional but must + be `Project` if provided. + type: string + name: + description: The `name` field of a `Project` resource. + type: string + namespace: + description: The `namespace` field of a `Project` resource. + type: string + type: object + resourceID: + description: Immutable. The DiscoveryEngineDataStore name. If not + given, the metadata.name will be used. + type: string + x-kubernetes-validations: + - message: ResourceID field is immutable + rule: self == oldSelf + solutionTypes: + description: |- + The solutions that the data store enrolls. Available solutions for each + [industry_vertical][google.cloud.discoveryengine.v1.DataStore.industry_vertical]: + + * `MEDIA`: `SOLUTION_TYPE_RECOMMENDATION` and `SOLUTION_TYPE_SEARCH`. + * `SITE_SEARCH`: `SOLUTION_TYPE_SEARCH` is automatically enrolled. Other + solutions cannot be enrolled. + items: + type: string + type: array + workspaceConfig: + description: Config to store data store type configuration for workspace + data. This must be set when [DataStore.content_config][google.cloud.discoveryengine.v1.DataStore.content_config] + is set as [DataStore.ContentConfig.GOOGLE_WORKSPACE][google.cloud.discoveryengine.v1.DataStore.ContentConfig.GOOGLE_WORKSPACE]. + properties: + dasherCustomerID: + description: Obfuscated Dasher customer ID. + type: string + superAdminEmailAddress: + description: Optional. The super admin email address for the workspace + that will be used for access token generation. For now we only + use it for Native Google Drive connector data ingestion. + type: string + superAdminServiceAccount: + description: Optional. The super admin service account for the + workspace that will be used for access token generation. For + now we only use it for Native Google Drive connector data ingestion. + type: string + type: + description: The Google Workspace data source. + type: string + type: object + required: + - location + - projectRef + type: object + status: + description: DiscoveryEngineDataStoreStatus defines the config connector + machine state of DiscoveryEngineDataStore + properties: + conditions: + description: Conditions represent the latest available observations + of the object's current state. + items: + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + type: string + message: + description: Human-readable message indicating details about + last transition. + type: string + reason: + description: Unique, one-word, CamelCase reason for the condition's + last transition. + type: string + status: + description: Status is the status of the condition. Can be True, + False, Unknown. + type: string + type: + description: Type is the type of the condition. + type: string + type: object + type: array + externalRef: + description: A unique specifier for the DiscoveryEngineDataStore resource + in GCP. + type: string + observedGeneration: + description: ObservedGeneration is the generation of the resource + that was most recently observed by the Config Connector controller. + If this is equal to metadata.generation, then that means that the + current reported status reflects the most recent desired state of + the resource. + format: int64 + type: integer + observedState: + description: ObservedState is the state of the resource as most recently + observed in GCP. + properties: + billingEstimation: + description: Output only. Data size estimation for billing. + properties: + structuredDataSize: + description: Data size for structured data in terms of bytes. + format: int64 + type: integer + structuredDataUpdateTime: + description: Last updated timestamp for structured data. + type: string + unstructuredDataSize: + description: Data size for unstructured data in terms of bytes. + format: int64 + type: integer + unstructuredDataUpdateTime: + description: Last updated timestamp for unstructured data. + type: string + websiteDataSize: + description: Data size for websites in terms of bytes. + format: int64 + type: integer + websiteDataUpdateTime: + description: Last updated timestamp for websites. + type: string + type: object + createTime: + description: Output only. Timestamp the [DataStore][google.cloud.discoveryengine.v1.DataStore] + was created at. + type: string + defaultSchemaID: + description: Output only. The id of the default [Schema][google.cloud.discoveryengine.v1.Schema] + asscociated to this data store. + type: string + type: object + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/installbundle/components/clusterroles/cnrm_admin.yaml b/config/installbundle/components/clusterroles/cnrm_admin.yaml index 4cad889e9e..ab5dc378e4 100644 --- a/config/installbundle/components/clusterroles/cnrm_admin.yaml +++ b/config/installbundle/components/clusterroles/cnrm_admin.yaml @@ -511,6 +511,18 @@ rules: - update - patch - delete +- apiGroups: + - discoveryengine.cnrm.cloud.google.com + resources: + - '*' + verbs: + - get + - list + - watch + - create + - update + - patch + - delete - apiGroups: - dlp.cnrm.cloud.google.com resources: diff --git a/config/installbundle/components/clusterroles/cnrm_viewer.yaml b/config/installbundle/components/clusterroles/cnrm_viewer.yaml index cc22b00f3a..e6ebf47163 100644 --- a/config/installbundle/components/clusterroles/cnrm_viewer.yaml +++ b/config/installbundle/components/clusterroles/cnrm_viewer.yaml @@ -342,6 +342,14 @@ rules: - get - list - watch +- apiGroups: + - discoveryengine.cnrm.cloud.google.com + resources: + - '*' + verbs: + - get + - list + - watch - apiGroups: - dlp.cnrm.cloud.google.com resources: diff --git a/pkg/clients/generated/apis/discoveryengine/group.go b/pkg/clients/generated/apis/discoveryengine/group.go new file mode 100644 index 0000000000..7b7237869e --- /dev/null +++ b/pkg/clients/generated/apis/discoveryengine/group.go @@ -0,0 +1,32 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Package discoveryengine contains discoveryengine API versions. +package discoveryengine diff --git a/pkg/clients/generated/apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go b/pkg/clients/generated/apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go new file mode 100644 index 0000000000..6a5ca3c4f1 --- /dev/null +++ b/pkg/clients/generated/apis/discoveryengine/v1alpha1/discoveryenginedatastore_types.go @@ -0,0 +1,184 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +package v1alpha1 + +import ( + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/k8s/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type DatastoreWorkspaceConfig struct { + /* Obfuscated Dasher customer ID. */ + // +optional + DasherCustomerID *string `json:"dasherCustomerID,omitempty"` + + /* Optional. The super admin email address for the workspace that will be used for access token generation. For now we only use it for Native Google Drive connector data ingestion. */ + // +optional + SuperAdminEmailAddress *string `json:"superAdminEmailAddress,omitempty"` + + /* Optional. The super admin service account for the workspace that will be used for access token generation. For now we only use it for Native Google Drive connector data ingestion. */ + // +optional + SuperAdminServiceAccount *string `json:"superAdminServiceAccount,omitempty"` + + /* The Google Workspace data source. */ + // +optional + Type *string `json:"type,omitempty"` +} + +type DiscoveryEngineDataStoreSpec struct { + /* Immutable. The content config of the data store. If this field is unset, the server behavior defaults to [ContentConfig.NO_CONTENT][google.cloud.discoveryengine.v1.DataStore.ContentConfig.NO_CONTENT]. */ + // +optional + ContentConfig *string `json:"contentConfig,omitempty"` + + /* Required. The data store display name. + + This field must be a UTF-8 encoded string with a length limit of 128 + characters. Otherwise, an INVALID_ARGUMENT error is returned. */ + // +optional + DisplayName *string `json:"displayName,omitempty"` + + /* Immutable. The industry vertical that the data store registers. */ + // +optional + IndustryVertical *string `json:"industryVertical,omitempty"` + + /* Immutable. The location for the resource. */ + Location string `json:"location"` + + /* The ID of the project in which the resource belongs. */ + ProjectRef v1alpha1.ResourceRef `json:"projectRef"` + + /* Immutable. The DiscoveryEngineDataStore name. If not given, the metadata.name will be used. */ + // +optional + ResourceID *string `json:"resourceID,omitempty"` + + /* The solutions that the data store enrolls. Available solutions for each + [industry_vertical][google.cloud.discoveryengine.v1.DataStore.industry_vertical]: + + * `MEDIA`: `SOLUTION_TYPE_RECOMMENDATION` and `SOLUTION_TYPE_SEARCH`. + * `SITE_SEARCH`: `SOLUTION_TYPE_SEARCH` is automatically enrolled. Other + solutions cannot be enrolled. */ + // +optional + SolutionTypes []string `json:"solutionTypes,omitempty"` + + /* Config to store data store type configuration for workspace data. This must be set when [DataStore.content_config][google.cloud.discoveryengine.v1.DataStore.content_config] is set as [DataStore.ContentConfig.GOOGLE_WORKSPACE][google.cloud.discoveryengine.v1.DataStore.ContentConfig.GOOGLE_WORKSPACE]. */ + // +optional + WorkspaceConfig *DatastoreWorkspaceConfig `json:"workspaceConfig,omitempty"` +} + +type DatastoreBillingEstimationStatus struct { + /* Data size for structured data in terms of bytes. */ + // +optional + StructuredDataSize *int64 `json:"structuredDataSize,omitempty"` + + /* Last updated timestamp for structured data. */ + // +optional + StructuredDataUpdateTime *string `json:"structuredDataUpdateTime,omitempty"` + + /* Data size for unstructured data in terms of bytes. */ + // +optional + UnstructuredDataSize *int64 `json:"unstructuredDataSize,omitempty"` + + /* Last updated timestamp for unstructured data. */ + // +optional + UnstructuredDataUpdateTime *string `json:"unstructuredDataUpdateTime,omitempty"` + + /* Data size for websites in terms of bytes. */ + // +optional + WebsiteDataSize *int64 `json:"websiteDataSize,omitempty"` + + /* Last updated timestamp for websites. */ + // +optional + WebsiteDataUpdateTime *string `json:"websiteDataUpdateTime,omitempty"` +} + +type DatastoreObservedStateStatus struct { + /* Output only. Data size estimation for billing. */ + // +optional + BillingEstimation *DatastoreBillingEstimationStatus `json:"billingEstimation,omitempty"` + + /* Output only. Timestamp the [DataStore][google.cloud.discoveryengine.v1.DataStore] was created at. */ + // +optional + CreateTime *string `json:"createTime,omitempty"` + + /* Output only. The id of the default [Schema][google.cloud.discoveryengine.v1.Schema] asscociated to this data store. */ + // +optional + DefaultSchemaID *string `json:"defaultSchemaID,omitempty"` +} + +type DiscoveryEngineDataStoreStatus struct { + /* Conditions represent the latest available observations of the + DiscoveryEngineDataStore's current state. */ + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` + /* A unique specifier for the DiscoveryEngineDataStore resource in GCP. */ + // +optional + ExternalRef *string `json:"externalRef,omitempty"` + + /* ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. */ + // +optional + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + + /* ObservedState is the state of the resource as most recently observed in GCP. */ + // +optional + ObservedState *DatastoreObservedStateStatus `json:"observedState,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:categories=gcp,shortName=gcpdiscoveryenginedatastore;gcpdiscoveryenginedatastores +// +kubebuilder:subresource:status +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true" +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" + +// DiscoveryEngineDataStore is the Schema for the discoveryengine API +// +k8s:openapi-gen=true +type DiscoveryEngineDataStore struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DiscoveryEngineDataStoreSpec `json:"spec,omitempty"` + Status DiscoveryEngineDataStoreStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// DiscoveryEngineDataStoreList contains a list of DiscoveryEngineDataStore +type DiscoveryEngineDataStoreList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []DiscoveryEngineDataStore `json:"items"` +} + +func init() { + SchemeBuilder.Register(&DiscoveryEngineDataStore{}, &DiscoveryEngineDataStoreList{}) +} diff --git a/pkg/clients/generated/apis/discoveryengine/v1alpha1/doc.go b/pkg/clients/generated/apis/discoveryengine/v1alpha1/doc.go new file mode 100644 index 0000000000..40ecf5207e --- /dev/null +++ b/pkg/clients/generated/apis/discoveryengine/v1alpha1/doc.go @@ -0,0 +1,38 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Package v1alpha1 contains API Schema definitions for the discoveryengine v1alpha1 API group. +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/pkg/apis/discoveryengine +// +k8s:defaulter-gen=TypeMeta +// +groupName=discoveryengine.cnrm.cloud.google.com + +package v1alpha1 diff --git a/pkg/clients/generated/apis/discoveryengine/v1alpha1/register.go b/pkg/clients/generated/apis/discoveryengine/v1alpha1/register.go new file mode 100644 index 0000000000..0831ced2e4 --- /dev/null +++ b/pkg/clients/generated/apis/discoveryengine/v1alpha1/register.go @@ -0,0 +1,63 @@ +// Copyright 2020 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. + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Config Connector and manual +// changes will be clobbered when the file is regenerated. +// +// ---------------------------------------------------------------------------- + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Package v1alpha1 contains API Schema definitions for the discoveryengine v1alpha1 API group. +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/pkg/apis/discoveryengine +// +k8s:defaulter-gen=TypeMeta +// +groupName=discoveryengine.cnrm.cloud.google.com +package v1alpha1 + +import ( + "reflect" + + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // SchemeGroupVersion is the group version used to register these objects. + SchemeGroupVersion = schema.GroupVersion{Group: "discoveryengine.cnrm.cloud.google.com", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + // AddToScheme is a global function that registers this API group & version to a scheme + AddToScheme = SchemeBuilder.AddToScheme + + DiscoveryEngineDataStoreGVK = schema.GroupVersionKind{ + Group: SchemeGroupVersion.Group, + Version: SchemeGroupVersion.Version, + Kind: reflect.TypeOf(DiscoveryEngineDataStore{}).Name(), + } + + discoveryengineAPIVersion = SchemeGroupVersion.String() +) diff --git a/pkg/clients/generated/apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go b/pkg/clients/generated/apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..477594bd72 --- /dev/null +++ b/pkg/clients/generated/apis/discoveryengine/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,287 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + k8sv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/k8s/v1alpha1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatastoreBillingEstimationStatus) DeepCopyInto(out *DatastoreBillingEstimationStatus) { + *out = *in + if in.StructuredDataSize != nil { + in, out := &in.StructuredDataSize, &out.StructuredDataSize + *out = new(int64) + **out = **in + } + if in.StructuredDataUpdateTime != nil { + in, out := &in.StructuredDataUpdateTime, &out.StructuredDataUpdateTime + *out = new(string) + **out = **in + } + if in.UnstructuredDataSize != nil { + in, out := &in.UnstructuredDataSize, &out.UnstructuredDataSize + *out = new(int64) + **out = **in + } + if in.UnstructuredDataUpdateTime != nil { + in, out := &in.UnstructuredDataUpdateTime, &out.UnstructuredDataUpdateTime + *out = new(string) + **out = **in + } + if in.WebsiteDataSize != nil { + in, out := &in.WebsiteDataSize, &out.WebsiteDataSize + *out = new(int64) + **out = **in + } + if in.WebsiteDataUpdateTime != nil { + in, out := &in.WebsiteDataUpdateTime, &out.WebsiteDataUpdateTime + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreBillingEstimationStatus. +func (in *DatastoreBillingEstimationStatus) DeepCopy() *DatastoreBillingEstimationStatus { + if in == nil { + return nil + } + out := new(DatastoreBillingEstimationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatastoreObservedStateStatus) DeepCopyInto(out *DatastoreObservedStateStatus) { + *out = *in + if in.BillingEstimation != nil { + in, out := &in.BillingEstimation, &out.BillingEstimation + *out = new(DatastoreBillingEstimationStatus) + (*in).DeepCopyInto(*out) + } + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = new(string) + **out = **in + } + if in.DefaultSchemaID != nil { + in, out := &in.DefaultSchemaID, &out.DefaultSchemaID + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreObservedStateStatus. +func (in *DatastoreObservedStateStatus) DeepCopy() *DatastoreObservedStateStatus { + if in == nil { + return nil + } + out := new(DatastoreObservedStateStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatastoreWorkspaceConfig) DeepCopyInto(out *DatastoreWorkspaceConfig) { + *out = *in + if in.DasherCustomerID != nil { + in, out := &in.DasherCustomerID, &out.DasherCustomerID + *out = new(string) + **out = **in + } + if in.SuperAdminEmailAddress != nil { + in, out := &in.SuperAdminEmailAddress, &out.SuperAdminEmailAddress + *out = new(string) + **out = **in + } + if in.SuperAdminServiceAccount != nil { + in, out := &in.SuperAdminServiceAccount, &out.SuperAdminServiceAccount + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatastoreWorkspaceConfig. +func (in *DatastoreWorkspaceConfig) DeepCopy() *DatastoreWorkspaceConfig { + if in == nil { + return nil + } + out := new(DatastoreWorkspaceConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStore) DeepCopyInto(out *DiscoveryEngineDataStore) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStore. +func (in *DiscoveryEngineDataStore) DeepCopy() *DiscoveryEngineDataStore { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStore) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DiscoveryEngineDataStore) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreList) DeepCopyInto(out *DiscoveryEngineDataStoreList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DiscoveryEngineDataStore, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreList. +func (in *DiscoveryEngineDataStoreList) DeepCopy() *DiscoveryEngineDataStoreList { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DiscoveryEngineDataStoreList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreSpec) DeepCopyInto(out *DiscoveryEngineDataStoreSpec) { + *out = *in + if in.ContentConfig != nil { + in, out := &in.ContentConfig, &out.ContentConfig + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.IndustryVertical != nil { + in, out := &in.IndustryVertical, &out.IndustryVertical + *out = new(string) + **out = **in + } + out.ProjectRef = in.ProjectRef + if in.ResourceID != nil { + in, out := &in.ResourceID, &out.ResourceID + *out = new(string) + **out = **in + } + if in.SolutionTypes != nil { + in, out := &in.SolutionTypes, &out.SolutionTypes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.WorkspaceConfig != nil { + in, out := &in.WorkspaceConfig, &out.WorkspaceConfig + *out = new(DatastoreWorkspaceConfig) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreSpec. +func (in *DiscoveryEngineDataStoreSpec) DeepCopy() *DiscoveryEngineDataStoreSpec { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiscoveryEngineDataStoreStatus) DeepCopyInto(out *DiscoveryEngineDataStoreStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]k8sv1alpha1.Condition, len(*in)) + copy(*out, *in) + } + if in.ExternalRef != nil { + in, out := &in.ExternalRef, &out.ExternalRef + *out = new(string) + **out = **in + } + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int64) + **out = **in + } + if in.ObservedState != nil { + in, out := &in.ObservedState, &out.ObservedState + *out = new(DatastoreObservedStateStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiscoveryEngineDataStoreStatus. +func (in *DiscoveryEngineDataStoreStatus) DeepCopy() *DiscoveryEngineDataStoreStatus { + if in == nil { + return nil + } + out := new(DiscoveryEngineDataStoreStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/clients/generated/client/clientset/versioned/clientset.go b/pkg/clients/generated/client/clientset/versioned/clientset.go index ecc665b633..167f411710 100644 --- a/pkg/clients/generated/client/clientset/versioned/clientset.go +++ b/pkg/clients/generated/client/clientset/versioned/clientset.go @@ -73,6 +73,7 @@ import ( deploymentmanagerv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/deploymentmanager/v1alpha1" dialogflowv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dialogflow/v1alpha1" dialogflowcxv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dialogflowcx/v1alpha1" + discoveryenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1" dlpv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dlp/v1beta1" dnsv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dns/v1alpha1" dnsv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dns/v1beta1" @@ -200,6 +201,7 @@ type Interface interface { DeploymentmanagerV1alpha1() deploymentmanagerv1alpha1.DeploymentmanagerV1alpha1Interface DialogflowV1alpha1() dialogflowv1alpha1.DialogflowV1alpha1Interface DialogflowcxV1alpha1() dialogflowcxv1alpha1.DialogflowcxV1alpha1Interface + DiscoveryengineV1alpha1() discoveryenginev1alpha1.DiscoveryengineV1alpha1Interface DlpV1beta1() dlpv1beta1.DlpV1beta1Interface DnsV1alpha1() dnsv1alpha1.DnsV1alpha1Interface DnsV1beta1() dnsv1beta1.DnsV1beta1Interface @@ -325,6 +327,7 @@ type Clientset struct { deploymentmanagerV1alpha1 *deploymentmanagerv1alpha1.DeploymentmanagerV1alpha1Client dialogflowV1alpha1 *dialogflowv1alpha1.DialogflowV1alpha1Client dialogflowcxV1alpha1 *dialogflowcxv1alpha1.DialogflowcxV1alpha1Client + discoveryengineV1alpha1 *discoveryenginev1alpha1.DiscoveryengineV1alpha1Client dlpV1beta1 *dlpv1beta1.DlpV1beta1Client dnsV1alpha1 *dnsv1alpha1.DnsV1alpha1Client dnsV1beta1 *dnsv1beta1.DnsV1beta1Client @@ -639,6 +642,11 @@ func (c *Clientset) DialogflowcxV1alpha1() dialogflowcxv1alpha1.DialogflowcxV1al return c.dialogflowcxV1alpha1 } +// DiscoveryengineV1alpha1 retrieves the DiscoveryengineV1alpha1Client +func (c *Clientset) DiscoveryengineV1alpha1() discoveryenginev1alpha1.DiscoveryengineV1alpha1Interface { + return c.discoveryengineV1alpha1 +} + // DlpV1beta1 retrieves the DlpV1beta1Client func (c *Clientset) DlpV1beta1() dlpv1beta1.DlpV1beta1Interface { return c.dlpV1beta1 @@ -1235,6 +1243,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.discoveryengineV1alpha1, err = discoveryenginev1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.dlpV1beta1, err = dlpv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -1592,6 +1604,7 @@ func New(c rest.Interface) *Clientset { cs.deploymentmanagerV1alpha1 = deploymentmanagerv1alpha1.New(c) cs.dialogflowV1alpha1 = dialogflowv1alpha1.New(c) cs.dialogflowcxV1alpha1 = dialogflowcxv1alpha1.New(c) + cs.discoveryengineV1alpha1 = discoveryenginev1alpha1.New(c) cs.dlpV1beta1 = dlpv1beta1.New(c) cs.dnsV1alpha1 = dnsv1alpha1.New(c) cs.dnsV1beta1 = dnsv1beta1.New(c) diff --git a/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go b/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go index a25d1378ca..98ef76b958 100644 --- a/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/clients/generated/client/clientset/versioned/fake/clientset_generated.go @@ -119,6 +119,8 @@ import ( fakedialogflowv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dialogflow/v1alpha1/fake" dialogflowcxv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dialogflowcx/v1alpha1" fakedialogflowcxv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dialogflowcx/v1alpha1/fake" + discoveryenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1" + fakediscoveryenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake" dlpv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dlp/v1beta1" fakedlpv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dlp/v1beta1/fake" dnsv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/dns/v1alpha1" @@ -560,6 +562,11 @@ func (c *Clientset) DialogflowcxV1alpha1() dialogflowcxv1alpha1.DialogflowcxV1al return &fakedialogflowcxv1alpha1.FakeDialogflowcxV1alpha1{Fake: &c.Fake} } +// DiscoveryengineV1alpha1 retrieves the DiscoveryengineV1alpha1Client +func (c *Clientset) DiscoveryengineV1alpha1() discoveryenginev1alpha1.DiscoveryengineV1alpha1Interface { + return &fakediscoveryenginev1alpha1.FakeDiscoveryengineV1alpha1{Fake: &c.Fake} +} + // DlpV1beta1 retrieves the DlpV1beta1Client func (c *Clientset) DlpV1beta1() dlpv1beta1.DlpV1beta1Interface { return &fakedlpv1beta1.FakeDlpV1beta1{Fake: &c.Fake} diff --git a/pkg/clients/generated/client/clientset/versioned/fake/register.go b/pkg/clients/generated/client/clientset/versioned/fake/register.go index 7d5e00d3ed..2bbee78fc0 100644 --- a/pkg/clients/generated/client/clientset/versioned/fake/register.go +++ b/pkg/clients/generated/client/clientset/versioned/fake/register.go @@ -70,6 +70,7 @@ import ( deploymentmanagerv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/deploymentmanager/v1alpha1" dialogflowv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dialogflow/v1alpha1" dialogflowcxv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dialogflowcx/v1alpha1" + discoveryenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/discoveryengine/v1alpha1" dlpv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dlp/v1beta1" dnsv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dns/v1alpha1" dnsv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dns/v1beta1" @@ -201,6 +202,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ deploymentmanagerv1alpha1.AddToScheme, dialogflowv1alpha1.AddToScheme, dialogflowcxv1alpha1.AddToScheme, + discoveryenginev1alpha1.AddToScheme, dlpv1beta1.AddToScheme, dnsv1alpha1.AddToScheme, dnsv1beta1.AddToScheme, diff --git a/pkg/clients/generated/client/clientset/versioned/scheme/register.go b/pkg/clients/generated/client/clientset/versioned/scheme/register.go index c8b4b10179..64556c0e74 100644 --- a/pkg/clients/generated/client/clientset/versioned/scheme/register.go +++ b/pkg/clients/generated/client/clientset/versioned/scheme/register.go @@ -70,6 +70,7 @@ import ( deploymentmanagerv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/deploymentmanager/v1alpha1" dialogflowv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dialogflow/v1alpha1" dialogflowcxv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dialogflowcx/v1alpha1" + discoveryenginev1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/discoveryengine/v1alpha1" dlpv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dlp/v1beta1" dnsv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dns/v1alpha1" dnsv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/dns/v1beta1" @@ -201,6 +202,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ deploymentmanagerv1alpha1.AddToScheme, dialogflowv1alpha1.AddToScheme, dialogflowcxv1alpha1.AddToScheme, + discoveryenginev1alpha1.AddToScheme, dlpv1beta1.AddToScheme, dnsv1alpha1.AddToScheme, dnsv1beta1.AddToScheme, diff --git a/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryengine_client.go b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryengine_client.go new file mode 100644 index 0000000000..5624ba169e --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryengine_client.go @@ -0,0 +1,110 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/discoveryengine/v1alpha1" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type DiscoveryengineV1alpha1Interface interface { + RESTClient() rest.Interface + DiscoveryEngineDataStoresGetter +} + +// DiscoveryengineV1alpha1Client is used to interact with features provided by the discoveryengine.cnrm.cloud.google.com group. +type DiscoveryengineV1alpha1Client struct { + restClient rest.Interface +} + +func (c *DiscoveryengineV1alpha1Client) DiscoveryEngineDataStores(namespace string) DiscoveryEngineDataStoreInterface { + return newDiscoveryEngineDataStores(c, namespace) +} + +// NewForConfig creates a new DiscoveryengineV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*DiscoveryengineV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new DiscoveryengineV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*DiscoveryengineV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &DiscoveryengineV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new DiscoveryengineV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *DiscoveryengineV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new DiscoveryengineV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *DiscoveryengineV1alpha1Client { + return &DiscoveryengineV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *DiscoveryengineV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryenginedatastore.go b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryenginedatastore.go new file mode 100644 index 0000000000..b29903487f --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/discoveryenginedatastore.go @@ -0,0 +1,198 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/discoveryengine/v1alpha1" + scheme "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// DiscoveryEngineDataStoresGetter has a method to return a DiscoveryEngineDataStoreInterface. +// A group's client should implement this interface. +type DiscoveryEngineDataStoresGetter interface { + DiscoveryEngineDataStores(namespace string) DiscoveryEngineDataStoreInterface +} + +// DiscoveryEngineDataStoreInterface has methods to work with DiscoveryEngineDataStore resources. +type DiscoveryEngineDataStoreInterface interface { + Create(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.CreateOptions) (*v1alpha1.DiscoveryEngineDataStore, error) + Update(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.UpdateOptions) (*v1alpha1.DiscoveryEngineDataStore, error) + UpdateStatus(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.UpdateOptions) (*v1alpha1.DiscoveryEngineDataStore, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.DiscoveryEngineDataStore, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.DiscoveryEngineDataStoreList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DiscoveryEngineDataStore, err error) + DiscoveryEngineDataStoreExpansion +} + +// discoveryEngineDataStores implements DiscoveryEngineDataStoreInterface +type discoveryEngineDataStores struct { + client rest.Interface + ns string +} + +// newDiscoveryEngineDataStores returns a DiscoveryEngineDataStores +func newDiscoveryEngineDataStores(c *DiscoveryengineV1alpha1Client, namespace string) *discoveryEngineDataStores { + return &discoveryEngineDataStores{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the discoveryEngineDataStore, and returns the corresponding discoveryEngineDataStore object, and an error if there is any. +func (c *discoveryEngineDataStores) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + result = &v1alpha1.DiscoveryEngineDataStore{} + err = c.client.Get(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of DiscoveryEngineDataStores that match those selectors. +func (c *discoveryEngineDataStores) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DiscoveryEngineDataStoreList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.DiscoveryEngineDataStoreList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested discoveryEngineDataStores. +func (c *discoveryEngineDataStores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a discoveryEngineDataStore and creates it. Returns the server's representation of the discoveryEngineDataStore, and an error, if there is any. +func (c *discoveryEngineDataStores) Create(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.CreateOptions) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + result = &v1alpha1.DiscoveryEngineDataStore{} + err = c.client.Post(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(discoveryEngineDataStore). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a discoveryEngineDataStore and updates it. Returns the server's representation of the discoveryEngineDataStore, and an error, if there is any. +func (c *discoveryEngineDataStores) Update(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.UpdateOptions) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + result = &v1alpha1.DiscoveryEngineDataStore{} + err = c.client.Put(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + Name(discoveryEngineDataStore.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(discoveryEngineDataStore). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *discoveryEngineDataStores) UpdateStatus(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.UpdateOptions) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + result = &v1alpha1.DiscoveryEngineDataStore{} + err = c.client.Put(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + Name(discoveryEngineDataStore.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(discoveryEngineDataStore). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the discoveryEngineDataStore and deletes it. Returns an error if one occurs. +func (c *discoveryEngineDataStores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *discoveryEngineDataStores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched discoveryEngineDataStore. +func (c *discoveryEngineDataStores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + result = &v1alpha1.DiscoveryEngineDataStore{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("discoveryenginedatastores"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/doc.go b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/doc.go new file mode 100644 index 0000000000..d3dac805d0 --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/doc.go @@ -0,0 +1,23 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/doc.go b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/doc.go new file mode 100644 index 0000000000..dfbe79f9af --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/doc.go @@ -0,0 +1,23 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryengine_client.go b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryengine_client.go new file mode 100644 index 0000000000..8a97a6369e --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryengine_client.go @@ -0,0 +1,43 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeDiscoveryengineV1alpha1 struct { + *testing.Fake +} + +func (c *FakeDiscoveryengineV1alpha1) DiscoveryEngineDataStores(namespace string) v1alpha1.DiscoveryEngineDataStoreInterface { + return &FakeDiscoveryEngineDataStores{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeDiscoveryengineV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryenginedatastore.go b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryenginedatastore.go new file mode 100644 index 0000000000..6213c4f32b --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/fake/fake_discoveryenginedatastore.go @@ -0,0 +1,144 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/discoveryengine/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeDiscoveryEngineDataStores implements DiscoveryEngineDataStoreInterface +type FakeDiscoveryEngineDataStores struct { + Fake *FakeDiscoveryengineV1alpha1 + ns string +} + +var discoveryenginedatastoresResource = v1alpha1.SchemeGroupVersion.WithResource("discoveryenginedatastores") + +var discoveryenginedatastoresKind = v1alpha1.SchemeGroupVersion.WithKind("DiscoveryEngineDataStore") + +// Get takes name of the discoveryEngineDataStore, and returns the corresponding discoveryEngineDataStore object, and an error if there is any. +func (c *FakeDiscoveryEngineDataStores) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(discoveryenginedatastoresResource, c.ns, name), &v1alpha1.DiscoveryEngineDataStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.DiscoveryEngineDataStore), err +} + +// List takes label and field selectors, and returns the list of DiscoveryEngineDataStores that match those selectors. +func (c *FakeDiscoveryEngineDataStores) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.DiscoveryEngineDataStoreList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(discoveryenginedatastoresResource, discoveryenginedatastoresKind, c.ns, opts), &v1alpha1.DiscoveryEngineDataStoreList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.DiscoveryEngineDataStoreList{ListMeta: obj.(*v1alpha1.DiscoveryEngineDataStoreList).ListMeta} + for _, item := range obj.(*v1alpha1.DiscoveryEngineDataStoreList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested discoveryEngineDataStores. +func (c *FakeDiscoveryEngineDataStores) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(discoveryenginedatastoresResource, c.ns, opts)) + +} + +// Create takes the representation of a discoveryEngineDataStore and creates it. Returns the server's representation of the discoveryEngineDataStore, and an error, if there is any. +func (c *FakeDiscoveryEngineDataStores) Create(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.CreateOptions) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(discoveryenginedatastoresResource, c.ns, discoveryEngineDataStore), &v1alpha1.DiscoveryEngineDataStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.DiscoveryEngineDataStore), err +} + +// Update takes the representation of a discoveryEngineDataStore and updates it. Returns the server's representation of the discoveryEngineDataStore, and an error, if there is any. +func (c *FakeDiscoveryEngineDataStores) Update(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.UpdateOptions) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(discoveryenginedatastoresResource, c.ns, discoveryEngineDataStore), &v1alpha1.DiscoveryEngineDataStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.DiscoveryEngineDataStore), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeDiscoveryEngineDataStores) UpdateStatus(ctx context.Context, discoveryEngineDataStore *v1alpha1.DiscoveryEngineDataStore, opts v1.UpdateOptions) (*v1alpha1.DiscoveryEngineDataStore, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(discoveryenginedatastoresResource, "status", c.ns, discoveryEngineDataStore), &v1alpha1.DiscoveryEngineDataStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.DiscoveryEngineDataStore), err +} + +// Delete takes name of the discoveryEngineDataStore and deletes it. Returns an error if one occurs. +func (c *FakeDiscoveryEngineDataStores) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(discoveryenginedatastoresResource, c.ns, name, opts), &v1alpha1.DiscoveryEngineDataStore{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeDiscoveryEngineDataStores) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(discoveryenginedatastoresResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.DiscoveryEngineDataStoreList{}) + return err +} + +// Patch applies the patch and returns the patched discoveryEngineDataStore. +func (c *FakeDiscoveryEngineDataStores) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.DiscoveryEngineDataStore, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(discoveryenginedatastoresResource, c.ns, name, pt, data, subresources...), &v1alpha1.DiscoveryEngineDataStore{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.DiscoveryEngineDataStore), err +} diff --git a/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/generated_expansion.go b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/generated_expansion.go new file mode 100644 index 0000000000..fce4e4c973 --- /dev/null +++ b/pkg/clients/generated/client/clientset/versioned/typed/discoveryengine/v1alpha1/generated_expansion.go @@ -0,0 +1,24 @@ +// Copyright 2020 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. + +// *** DISCLAIMER *** +// Config Connector's go-client for CRDs is currently in ALPHA, which means +// that future versions of the go-client may include breaking changes. +// Please try it out and give us feedback! + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type DiscoveryEngineDataStoreExpansion interface{} diff --git a/pkg/gvks/supportedgvks/gvks_generated.go b/pkg/gvks/supportedgvks/gvks_generated.go index d044c9eff7..785ffa0a6d 100644 --- a/pkg/gvks/supportedgvks/gvks_generated.go +++ b/pkg/gvks/supportedgvks/gvks_generated.go @@ -2300,6 +2300,16 @@ var SupportedGVKs = map[schema.GroupVersionKind]GVKMetadata{ "cnrm.cloud.google.com/tf2crd": "true", }, }, + { + Group: "discoveryengine.cnrm.cloud.google.com", + Version: "v1alpha1", + Kind: "DiscoveryEngineDataStore", + }: { + Labels: map[string]string{ + "cnrm.cloud.google.com/managed-by-kcc": "true", + "cnrm.cloud.google.com/system": "true", + }, + }, { Group: "dlp.cnrm.cloud.google.com", Version: "v1beta1",