|
| 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 | + bigtablev1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/bigtable/v1beta1" |
| 19 | + refv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" |
| 20 | + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" |
| 21 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | +) |
| 23 | + |
| 24 | +var BigtableAuthorizedViewGVK = GroupVersion.WithKind("BigtableAuthorizedView") |
| 25 | + |
| 26 | +type BigtableAuthorizedViewParent struct { |
| 27 | + // +required |
| 28 | + ProjectRef *refv1beta1.ProjectRef `json:"projectRef"` |
| 29 | + |
| 30 | + // +required |
| 31 | + InstanceRef bigtablev1beta1.InstanceRef `json:"instanceRef"` |
| 32 | + |
| 33 | + // +required |
| 34 | + TableRef bigtablev1beta1.TableRef `json:"tableRef"` |
| 35 | +} |
| 36 | + |
| 37 | +// BigtableAuthorizedViewSpec defines the desired state of BigtableAuthorizedView |
| 38 | +// +kcc:proto=google.bigtable.admin.v2.AuthorizedView |
| 39 | +type BigtableAuthorizedViewSpec struct { |
| 40 | + // The BigtableAuthorizedView name. If not given, the metadata.name will be used. |
| 41 | + ResourceID *string `json:"resourceID,omitempty"` |
| 42 | + |
| 43 | + // +required |
| 44 | + BigtableAuthorizedViewParent `json:",inline"` |
| 45 | + |
| 46 | + // An AuthorizedView permitting access to an explicit subset of a Table. |
| 47 | + // +kcc:proto:field=google.bigtable.admin.v2.AuthorizedView.subset_view |
| 48 | + SubsetView *AuthorizedView_SubsetView `json:"subsetView,omitempty"` |
| 49 | + |
| 50 | + // The etag for this AuthorizedView. |
| 51 | + // If this is provided on update, it must match the server's etag. The server |
| 52 | + // returns ABORTED error on a mismatched etag. |
| 53 | + // +kcc:proto:field=google.bigtable.admin.v2.AuthorizedView.etag |
| 54 | + Etag *string `json:"etag,omitempty"` |
| 55 | + |
| 56 | + // Set to true to make the AuthorizedView protected against deletion. |
| 57 | + // The parent Table and containing Instance cannot be deleted if an |
| 58 | + // AuthorizedView has this bit set. |
| 59 | + // +kcc:proto:field=google.bigtable.admin.v2.AuthorizedView.deletion_protection |
| 60 | + DeletionProtection *bool `json:"deletionProtection,omitempty"` |
| 61 | +} |
| 62 | + |
| 63 | +// BigtableAuthorizedViewStatus defines the config connector machine state of BigtableAuthorizedView |
| 64 | +type BigtableAuthorizedViewStatus struct { |
| 65 | + /* Conditions represent the latest available observations of the |
| 66 | + object's current state. */ |
| 67 | + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` |
| 68 | + |
| 69 | + // 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. |
| 70 | + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` |
| 71 | + |
| 72 | + // A unique specifier for the BigtableAuthorizedView resource in GCP. |
| 73 | + ExternalRef *string `json:"externalRef,omitempty"` |
| 74 | + |
| 75 | + // ObservedState is the state of the resource as most recently observed in GCP. |
| 76 | + ObservedState *BigtableAuthorizedViewObservedState `json:"observedState,omitempty"` |
| 77 | +} |
| 78 | + |
| 79 | +// BigtableAuthorizedViewObservedState is the state of the BigtableAuthorizedView resource as most recently observed in GCP. |
| 80 | +// +kcc:proto=google.bigtable.admin.v2.AuthorizedView |
| 81 | +type BigtableAuthorizedViewObservedState struct { |
| 82 | +} |
| 83 | + |
| 84 | +// +genclient |
| 85 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 86 | +// +kubebuilder:resource:categories=gcp,shortName=gcpbigtableauthorizedview;gcpbigtableauthorizedviews |
| 87 | +// +kubebuilder:subresource:status |
| 88 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true" |
| 89 | +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" |
| 90 | +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" |
| 91 | +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" |
| 92 | +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" |
| 93 | + |
| 94 | +// BigtableAuthorizedView is the Schema for the BigtableAuthorizedView API |
| 95 | +// +k8s:openapi-gen=true |
| 96 | +type BigtableAuthorizedView struct { |
| 97 | + metav1.TypeMeta `json:",inline"` |
| 98 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 99 | + |
| 100 | + // +required |
| 101 | + Spec BigtableAuthorizedViewSpec `json:"spec,omitempty"` |
| 102 | + Status BigtableAuthorizedViewStatus `json:"status,omitempty"` |
| 103 | +} |
| 104 | + |
| 105 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 106 | +// BigtableAuthorizedViewList contains a list of BigtableAuthorizedView |
| 107 | +type BigtableAuthorizedViewList struct { |
| 108 | + metav1.TypeMeta `json:",inline"` |
| 109 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 110 | + Items []BigtableAuthorizedView `json:"items"` |
| 111 | +} |
| 112 | + |
| 113 | +func init() { |
| 114 | + SchemeBuilder.Register(&BigtableAuthorizedView{}, &BigtableAuthorizedViewList{}) |
| 115 | +} |
0 commit comments