|
| 1 | +// Copyright 2025 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +package v1alpha1 |
| 16 | + |
| 17 | +import ( |
| 18 | + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" |
| 19 | + // GCP Resource Reference type. |
| 20 | + refv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" |
| 21 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | +) |
| 23 | + |
| 24 | +var DataplexEntryGroupGVK = GroupVersion.WithKind("DataplexEntryGroup") |
| 25 | + |
| 26 | +// The Parent resource that the DataplexEntryGroup resource resides in. |
| 27 | +type DataplexEntryGroupParent struct { |
| 28 | + // +required |
| 29 | + ProjectRef *refv1beta1.ProjectRef `json:"projectRef"` |
| 30 | + // +required |
| 31 | + Location string `json:"location"` |
| 32 | +} |
| 33 | + |
| 34 | +// DataplexEntryGroupSpec defines the desired state of DataplexEntryGroup |
| 35 | +// +kcc:proto=google.cloud.dataplex.v1.EntryGroup |
| 36 | +type DataplexEntryGroupSpec struct { |
| 37 | + DataplexEntryGroupParent `json:",inline"` |
| 38 | + // The DataplexEntryGroup name. If not given, the metadata.name will be used. |
| 39 | + ResourceID *string `json:"resourceID,omitempty"` |
| 40 | + |
| 41 | + // Optional. Description of the EntryGroup. |
| 42 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.description |
| 43 | + Description *string `json:"description,omitempty"` |
| 44 | + |
| 45 | + // Optional. User friendly display name. |
| 46 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.display_name |
| 47 | + DisplayName *string `json:"displayName,omitempty"` |
| 48 | + |
| 49 | + // Optional. User-defined labels for the EntryGroup. |
| 50 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.labels |
| 51 | + Labels map[string]string `json:"labels,omitempty"` |
| 52 | + |
| 53 | + // This checksum is computed by the service, and might be sent on update and |
| 54 | + // delete requests to ensure the client has an up-to-date value before |
| 55 | + // proceeding. |
| 56 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.etag |
| 57 | + Etag *string `json:"etag,omitempty"` |
| 58 | +} |
| 59 | + |
| 60 | +// DataplexEntryGroupStatus defines the config connector machine state of DataplexEntryGroup |
| 61 | +type DataplexEntryGroupStatus struct { |
| 62 | + /* Conditions represent the latest available observations of the |
| 63 | + object's current state. */ |
| 64 | + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` |
| 65 | + |
| 66 | + // 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. |
| 67 | + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` |
| 68 | + |
| 69 | + // A unique specifier for the DataplexEntryGroup resource in GCP. |
| 70 | + ExternalRef *string `json:"externalRef,omitempty"` |
| 71 | + |
| 72 | + // ObservedState is the state of the resource as most recently observed in GCP. |
| 73 | + ObservedState *DataplexEntryGroupObservedState `json:"observedState,omitempty"` |
| 74 | +} |
| 75 | + |
| 76 | +// DataplexEntryGroupObservedState is the state of the DataplexEntryGroup resource as most recently observed in GCP. |
| 77 | +// +kcc:proto=google.cloud.dataplex.v1.EntryGroup |
| 78 | +type DataplexEntryGroupObservedState struct { |
| 79 | + // Output only. System generated globally unique ID for the EntryGroup. If you |
| 80 | + // delete and recreate the EntryGroup with the same name, this ID will be |
| 81 | + // different. |
| 82 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.uid |
| 83 | + Uid *string `json:"uid,omitempty"` |
| 84 | + |
| 85 | + // Output only. The time when the EntryGroup was created. |
| 86 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.create_time |
| 87 | + CreateTime *string `json:"createTime,omitempty"` |
| 88 | + |
| 89 | + // Output only. The time when the EntryGroup was last updated. |
| 90 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.update_time |
| 91 | + UpdateTime *string `json:"updateTime,omitempty"` |
| 92 | + |
| 93 | + // Output only. Denotes the transfer status of the Entry Group. It is |
| 94 | + // unspecified for Entry Group created from Dataplex API. |
| 95 | + // +kcc:proto:field=google.cloud.dataplex.v1.EntryGroup.transfer_status |
| 96 | + TransferStatus *string `json:"transferStatus,omitempty"` |
| 97 | +} |
| 98 | + |
| 99 | +// +genclient |
| 100 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 101 | +// TODO(user): make sure the pluralizaiton below is correct |
| 102 | +// +kubebuilder:resource:categories=gcp,shortName=gcpdataplexentrygroup;gcpdataplexentrygroups |
| 103 | +// +kubebuilder:subresource:status |
| 104 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true" |
| 105 | +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" |
| 106 | +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" |
| 107 | +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" |
| 108 | +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" |
| 109 | + |
| 110 | +// DataplexEntryGroup is the Schema for the DataplexEntryGroup API |
| 111 | +// +k8s:openapi-gen=true |
| 112 | +type DataplexEntryGroup struct { |
| 113 | + metav1.TypeMeta `json:",inline"` |
| 114 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 115 | + |
| 116 | + // +required |
| 117 | + Spec DataplexEntryGroupSpec `json:"spec,omitempty"` |
| 118 | + Status DataplexEntryGroupStatus `json:"status,omitempty"` |
| 119 | +} |
| 120 | + |
| 121 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 122 | +// DataplexEntryGroupList contains a list of DataplexEntryGroup |
| 123 | +type DataplexEntryGroupList struct { |
| 124 | + metav1.TypeMeta `json:",inline"` |
| 125 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 126 | + Items []DataplexEntryGroup `json:"items"` |
| 127 | +} |
| 128 | + |
| 129 | +func init() { |
| 130 | + SchemeBuilder.Register(&DataplexEntryGroup{}, &DataplexEntryGroupList{}) |
| 131 | +} |
0 commit comments