Skip to content

Commit 6428491

Browse files
Merge pull request GoogleCloudPlatform#3048 from acpana/acpana/bqahde-beta
feat: promote DataExchange to beta
2 parents f485d48 + 1fe5937 commit 6428491

File tree

44 files changed

+2245
-237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2245
-237
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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 v1beta1
16+
17+
import (
18+
refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"
19+
20+
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1"
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
var BigQueryAnalyticsHubDataExchangeGVK = GroupVersion.WithKind("BigQueryAnalyticsHubDataExchange")
25+
26+
// BigQueryAnalyticsHubDataExchangeSpec defines the desired state of BigQueryAnalyticsHubDataExchange
27+
// +kcc:proto=google.cloud.bigquery.analyticshub.v1.DataExchange
28+
type BigQueryAnalyticsHubDataExchangeSpec struct {
29+
// Required. Human-readable display name of the data exchange. The display
30+
// name must contain only Unicode letters, numbers (0-9), underscores (_),
31+
// dashes (-), spaces ( ), ampersands (&) and must not start or end with
32+
// spaces. Default value is an empty string. Max length: 63 bytes.
33+
DisplayName *string `json:"displayName,omitempty"`
34+
35+
// Optional. Description of the data exchange. The description must not
36+
// contain Unicode non-characters as well as C0 and C1 control codes except
37+
// tabs (HT), new lines (LF), carriage returns (CR), and page breaks (FF).
38+
// Default value is an empty string.
39+
// Max length: 2000 bytes.
40+
Description *string `json:"description,omitempty"`
41+
42+
// Optional. Email or URL of the primary point of contact of the data
43+
// exchange. Max Length: 1000 bytes.
44+
PrimaryContact *string `json:"primaryContact,omitempty"`
45+
46+
// Optional. Documentation describing the data exchange.
47+
Documentation *string `json:"documentation,omitempty"`
48+
49+
// TODO(KCC): NOT YET
50+
// // Optional. Base64 encoded image representing the data exchange. Max
51+
// // Size: 3.0MiB Expected image dimensions are 512x512 pixels, however the API
52+
// // only performs validation on size of the encoded data. Note: For byte
53+
// // fields, the content of the fields are base64-encoded (which increases the
54+
// // size of the data by 33-36%) when using JSON on the wire.
55+
// Icon *string `json:"icon,omitempty"`
56+
57+
// As of now SharingEnvironmentConfig is empty or output only so let's not include it as
58+
// part of the spec yet.
59+
// // Optional. Configurable data sharing environment option for a data exchange.
60+
// SharingEnvironmentConfig *SharingEnvironmentConfig `json:"sharingEnvironmentConfig,omitempty"`
61+
62+
// Optional. Type of discovery on the discovery page for all the listings
63+
// under this exchange. Updating this field also updates (overwrites) the
64+
// discovery_type field for all the listings under this exchange.
65+
DiscoveryType *string `json:"discoveryType,omitempty"`
66+
67+
/* Immutable. The name of the location this data exchange. */
68+
Location string `json:"location"`
69+
70+
/* The project that this resource belongs to. */
71+
ProjectRef *refs.ProjectRef `json:"projectRef"`
72+
73+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ResourceID field is immutable"
74+
// Immutable.
75+
// The BigQueryAnalyticsHubDataExchange name. If not given, the metadata.name will be used.
76+
// + optional
77+
ResourceID *string `json:"resourceID,omitempty"`
78+
}
79+
80+
// BigQueryAnalyticsHubDataExchangeStatus defines the config connector machine state of BigQueryAnalyticsHubDataExchange
81+
type BigQueryAnalyticsHubDataExchangeStatus struct {
82+
/* Conditions represent the latest available observations of the
83+
object's current state. */
84+
Conditions []v1alpha1.Condition `json:"conditions,omitempty"`
85+
86+
// 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.
87+
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
88+
89+
// A unique specifier for the BigQueryAnalyticsHubDataExchange resource in GCP.
90+
ExternalRef *string `json:"externalRef,omitempty"`
91+
92+
// ObservedState is the state of the resource as most recently observed in GCP.
93+
ObservedState *BigQueryAnalyticsHubDataExchangeObservedState `json:"observedState,omitempty"`
94+
}
95+
96+
// BigQueryAnalyticsHubDataExchangeSpec defines the desired state of BigQueryAnalyticsHubDataExchange
97+
// +kcc:proto=google.cloud.bigquery.analyticshub.v1.DataExchange
98+
type BigQueryAnalyticsHubDataExchangeObservedState struct {
99+
// This field is in the same format as our externalRef! So it's redundant.
100+
// // Output only. The resource name of the data exchange.
101+
// // e.g. `projects/myproject/locations/US/dataExchanges/123`.
102+
// Name *string `json:"name,omitempty"`
103+
104+
/* Number of listings contained in the data exchange. */
105+
// +optional
106+
ListingCount *int64 `json:"listingCount,omitempty"`
107+
}
108+
109+
// +genclient
110+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
111+
// +kubebuilder:resource:categories=gcp,shortName=gcpbigqueryanalyticshubdataexchange;gcpbigqueryanalyticshubdataexchanges
112+
// +kubebuilder:resource:categories=gcp
113+
// +kubebuilder:subresource:status
114+
// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true";"cnrm.cloud.google.com/stability-level=alpha"
115+
// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date"
116+
// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded"
117+
// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'"
118+
// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'"
119+
// +kubebuilder:storageversion
120+
// BigQueryAnalyticsHubDataExchange is the Schema for the BigQueryAnalyticsHubDataExchange API
121+
// +k8s:openapi-gen=true
122+
type BigQueryAnalyticsHubDataExchange struct {
123+
metav1.TypeMeta `json:",inline"`
124+
metav1.ObjectMeta `json:"metadata,omitempty"`
125+
126+
// +required
127+
Spec BigQueryAnalyticsHubDataExchangeSpec `json:"spec,omitempty"`
128+
Status BigQueryAnalyticsHubDataExchangeStatus `json:"status,omitempty"`
129+
}
130+
131+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
132+
// BigQueryAnalyticsHubDataExchangeList contains a list of BigQueryAnalyticsHubDataExchange
133+
type BigQueryAnalyticsHubDataExchangeList struct {
134+
metav1.TypeMeta `json:",inline"`
135+
metav1.ListMeta `json:"metadata,omitempty"`
136+
Items []BigQueryAnalyticsHubDataExchange `json:"items"`
137+
}
138+
139+
func init() {
140+
SchemeBuilder.Register(&BigQueryAnalyticsHubDataExchange{}, &BigQueryAnalyticsHubDataExchangeList{})
141+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
// +kcc:proto=google.cloud.bigquery.analyticshub.v1
16+
package v1beta1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
// +kubebuilder:object:generate=true
16+
// +groupName=bigqueryanalyticshub.cnrm.cloud.google.com
17+
package v1beta1
18+
19+
import (
20+
"k8s.io/apimachinery/pkg/runtime/schema"
21+
"sigs.k8s.io/controller-runtime/pkg/scheme"
22+
)
23+
24+
var (
25+
// GroupVersion is group version used to register these objects
26+
GroupVersion = schema.GroupVersion{Group: "bigqueryanalyticshub.cnrm.cloud.google.com", Version: "v1alpha1"}
27+
28+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
29+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
30+
31+
// AddToScheme adds the types in this group-version to the given scheme.
32+
AddToScheme = SchemeBuilder.AddToScheme
33+
34+
DataExchangeGVK = schema.GroupVersionKind{
35+
Group: GroupVersion.Group,
36+
Version: GroupVersion.Version,
37+
Kind: "BigQueryAnalyticsHubDataExchange",
38+
}
39+
)

0 commit comments

Comments
 (0)