|
| 1 | +// Copyright 2024 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 | + refv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" |
| 19 | + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +var BigQueryAnalyticsHubListingGVK = GroupVersion.WithKind("BigQueryAnalyticsHubDataExchangeListing") |
| 24 | + |
| 25 | +type BigQueryDatasetSource struct { |
| 26 | + // +required |
| 27 | + // Resource name of the dataset source for this listing. |
| 28 | + // e.g. `projects/myproject/datasets/123` |
| 29 | + Dataset *refv1beta1.BigQueryDatasetRef `json:"datasetRef,omitempty"` |
| 30 | + |
| 31 | + // Optional. Resources in this dataset that are selectively shared. |
| 32 | + // If this field is empty, then the entire dataset (all resources) are |
| 33 | + // shared. This field is only valid for data clean room exchanges. |
| 34 | + SelectedResources []Listing_BigQueryDatasetSource_SelectedResource `json:"selectedResources,omitempty"` |
| 35 | + |
| 36 | + // Optional. If set, restricted export policy will be propagated and |
| 37 | + // enforced on the linked dataset. |
| 38 | + RestrictedExportPolicy *Listing_BigQueryDatasetSource_RestrictedExportPolicy `json:"restrictedExportPolicy,omitempty"` |
| 39 | +} |
| 40 | +type Source struct { |
| 41 | + // One of the following fields must be set. |
| 42 | + BigQueryDatasetSource *BigQueryDatasetSource `json:"bigQueryDatasetSource,omitempty"` |
| 43 | + |
| 44 | + // NOT YET |
| 45 | + // PubsubTopicSource *PubsubTopicSource `json:"pubsubTopicSource,omitempty"` |
| 46 | +} |
| 47 | + |
| 48 | +// BigQueryAnalyticsHubListingSpec defines the desired state of BigQueryAnalyticsHubDataExchangeListing |
| 49 | +// +kcc:proto=google.cloud.bigquery.analyticshub.v1.Listing |
| 50 | +type BigQueryAnalyticsHubListingSpec struct { |
| 51 | + // +required |
| 52 | + Source *Source `json:"source,omitempty"` |
| 53 | + |
| 54 | + // +required |
| 55 | + // Required. Human-readable display name of the listing. The display name must |
| 56 | + // contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), |
| 57 | + // spaces ( ), ampersands (&) and can't start or end with spaces. Default |
| 58 | + // value is an empty string. Max length: 63 bytes. |
| 59 | + DisplayName *string `json:"displayName,omitempty"` |
| 60 | + |
| 61 | + // Optional. Short description of the listing. The description must contain only |
| 62 | + // Unicode characters or tabs (HT), new lines (LF), carriage returns (CR), and |
| 63 | + // page breaks (FF). Default value is an empty string. Max length: 2000 bytes. |
| 64 | + Description *string `json:"description,omitempty"` |
| 65 | + |
| 66 | + // Optional. Email or URL of the primary point of contact of the listing. |
| 67 | + // Max Length: 1000 bytes. |
| 68 | + PrimaryContact *string `json:"primaryContact,omitempty"` |
| 69 | + |
| 70 | + // Optional. Documentation describing the listing. |
| 71 | + Documentation *string `json:"documentation,omitempty"` |
| 72 | + |
| 73 | + // Optional. Details of the data provider who owns the source data. |
| 74 | + DataProvider *DataProvider `json:"dataProvider,omitempty"` |
| 75 | + |
| 76 | + // Optional. Categories of the listing. Up to two categories are allowed. |
| 77 | + Categories []string `json:"categories,omitempty"` |
| 78 | + |
| 79 | + // Optional. Details of the publisher who owns the listing and who can share |
| 80 | + // the source data. |
| 81 | + Publisher *Publisher `json:"publisher,omitempty"` |
| 82 | + |
| 83 | + // Optional. Email or URL of the request access of the listing. |
| 84 | + // Subscribers can use this reference to request access. |
| 85 | + // Max Length: 1000 bytes. |
| 86 | + RequestAccess *string `json:"requestAccess,omitempty"` |
| 87 | + |
| 88 | + // Not yet |
| 89 | + // // Optional. If set, restricted export configuration will be propagated and |
| 90 | + // // enforced on the linked dataset. |
| 91 | + // RestrictedExportConfig *Listing_RestrictedExportConfig `json:"restrictedExportConfig,omitempty"` |
| 92 | + |
| 93 | + // Optional. Type of discovery of the listing on the discovery page. |
| 94 | + DiscoveryType *string `json:"discoveryType,omitempty"` |
| 95 | + |
| 96 | + // Not yet |
| 97 | + // // Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB |
| 98 | + // // Expected image dimensions are 512x512 pixels, however the API only |
| 99 | + // // performs validation on size of the encoded data. |
| 100 | + // // Note: For byte fields, the contents of the field are base64-encoded (which |
| 101 | + // // increases the size of the data by 33-36%) when using JSON on the wire. |
| 102 | + // Icon []byte `json:"icon,omitempty"` |
| 103 | + |
| 104 | + // Not yet |
| 105 | + // Source *Listing_Source `json:"source,omitempty"` |
| 106 | + |
| 107 | + /* Immutable. The name of the location this data exchange. */ |
| 108 | + // +required |
| 109 | + Location string `json:"location"` |
| 110 | + |
| 111 | + // +required |
| 112 | + ProjectRef *refv1beta1.ProjectRef `json:"projectRef"` |
| 113 | + |
| 114 | + // +required |
| 115 | + DataExchangeRef *refv1beta1.DataExchangeRef `json:"dataExchangeRef"` |
| 116 | + |
| 117 | + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ResourceID field is immutable" |
| 118 | + // Immutable. |
| 119 | + // The BigQueryAnalyticsHubDataExchangeListing name. If not given, the metadata.name will be used. |
| 120 | + // + optional |
| 121 | + ResourceID *string `json:"resourceID,omitempty"` |
| 122 | +} |
| 123 | + |
| 124 | +// BigQueryAnalyticsHubListingStatus defines the config connector machine state of BigQueryAnalyticsHubDataExchangeListing |
| 125 | +type BigQueryAnalyticsHubListingStatus struct { |
| 126 | + /* Conditions represent the latest available observations of the |
| 127 | + object's current state. */ |
| 128 | + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` |
| 129 | + |
| 130 | + // 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. |
| 131 | + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` |
| 132 | + |
| 133 | + // A unique specifier for the BigQueryAnalyticsHubDataExchangeListing resource in GCP. |
| 134 | + ExternalRef *string `json:"externalRef,omitempty"` |
| 135 | + |
| 136 | + // ObservedState is the state of the resource as most recently observed in GCP. |
| 137 | + ObservedState *BigQueryAnalyticsHubListingObservedState `json:"observedState,omitempty"` |
| 138 | +} |
| 139 | + |
| 140 | +// BigQueryAnalyticsHubDataExchangeListingSpec defines the desired state of BigQueryAnalyticsHubDataExchangeListing |
| 141 | +// +kcc:proto=google.cloud.bigquery.analyticshub.v1.Listing |
| 142 | +type BigQueryAnalyticsHubListingObservedState struct { |
| 143 | + // This field is in the same format as our externalRef! So it's redundant. |
| 144 | + // // Output only. The resource name of the data exchange. |
| 145 | + // // e.g. `projects/myproject/locations/US/dataExchanges/123/listing/456`. |
| 146 | + // Name *string `json:"name,omitempty"` |
| 147 | + |
| 148 | + // Output only. Current state of the listing. |
| 149 | + State *string `json:"state,omitempty"` |
| 150 | +} |
| 151 | + |
| 152 | +// +genclient |
| 153 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 154 | +// +kubebuilder:resource:categories=gcp |
| 155 | +// +kubebuilder:subresource:status |
| 156 | +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true" |
| 157 | +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" |
| 158 | +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" |
| 159 | +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" |
| 160 | +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" |
| 161 | + |
| 162 | +// BigQueryAnalyticsHubListing is the Schema for the BigQueryAnalyticsHubListing API |
| 163 | +// +k8s:openapi-gen=true |
| 164 | +type BigQueryAnalyticsHubListing struct { |
| 165 | + metav1.TypeMeta `json:",inline"` |
| 166 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 167 | + |
| 168 | + Spec BigQueryAnalyticsHubListingSpec `json:"spec,omitempty"` |
| 169 | + Status BigQueryAnalyticsHubListingStatus `json:"status,omitempty"` |
| 170 | +} |
| 171 | + |
| 172 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 173 | +// BigQueryAnalyticsHubListingList contains a list of BigQueryAnalyticsHubDataExchangeListing |
| 174 | +type BigQueryAnalyticsHubListingList struct { |
| 175 | + metav1.TypeMeta `json:",inline"` |
| 176 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 177 | + Items []BigQueryAnalyticsHubListing `json:"items"` |
| 178 | +} |
| 179 | + |
| 180 | +func init() { |
| 181 | + SchemeBuilder.Register(&BigQueryAnalyticsHubListing{}, &BigQueryAnalyticsHubListingList{}) |
| 182 | +} |
0 commit comments