diff --git a/apis/bigqueryanalyticshub/v1beta1/listing_reference.go b/apis/bigqueryanalyticshub/v1beta1/listing_reference.go new file mode 100644 index 0000000000..5fc720fb20 --- /dev/null +++ b/apis/bigqueryanalyticshub/v1beta1/listing_reference.go @@ -0,0 +1,214 @@ +// 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 v1beta1 + +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 = &BigQueryAnalyticsHubListingRef{} + +// BigQueryAnalyticsHubListingRef defines the resource reference to BigQueryAnalyticsHubListing, which "External" field +// holds the GCP identifier for the KRM object. +type BigQueryAnalyticsHubListingRef struct { + // A reference to an externally managed BigQueryAnalyticsHubListing resource. + // Should be in the format "projects//locations//listings/". + External string `json:"external,omitempty"` + + // The name of a BigQueryAnalyticsHubListing resource. + Name string `json:"name,omitempty"` + + // The namespace of a BigQueryAnalyticsHubListing resource. + Namespace string `json:"namespace,omitempty"` + + parent *BigQueryAnalyticsHubListingParent +} + +// NormalizedExternal provision the "External" value for other resource that depends on BigQueryAnalyticsHubListing. +// If the "External" is given in the other resource's spec.BigQueryAnalyticsHubListingRef, the given value will be used. +// Otherwise, the "Name" and "Namespace" will be used to query the actual BigQueryAnalyticsHubListing object from the cluster. +func (r *BigQueryAnalyticsHubListingRef) 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", BigQueryAnalyticsHubListingGVK.Kind) + } + // From given External + if r.External != "" { + if _, _, err := parseBigQueryAnalyticsHubListingExternal(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(BigQueryAnalyticsHubListingGVK) + 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", BigQueryAnalyticsHubListingGVK, 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 "", fmt.Errorf("BigQueryAnalyticsHubListing is not ready yet") + } + r.External = actualExternalRef + return r.External, nil +} + +// New builds a BigQueryAnalyticsHubListingRef from the Config Connector BigQueryAnalyticsHubListing object. +func NewBigQueryAnalyticsHubListingRef(ctx context.Context, reader client.Reader, obj *BigQueryAnalyticsHubListing) (*BigQueryAnalyticsHubListingRef, error) { + id := &BigQueryAnalyticsHubListingRef{} + + // Get Parent + projectRef, err := refsv1beta1.ResolveProject(ctx, reader, obj.GetNamespace(), 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 + if location == "" { + return nil, fmt.Errorf("location cannot be empty") + } + + if obj.Spec.DataExchangeRef == nil { + return nil, fmt.Errorf("spec.dataExchangeRef cannot be empty") + } + dataExchangeExternal, err := obj.Spec.DataExchangeRef.NormalizedExternal(ctx, reader, obj.Namespace) + if err != nil { + return nil, fmt.Errorf("cannot normalize dataExchangeRef for listing ref: %w", err) + } + + dataExchangeID, err := ParseDataExchangeIdentity(dataExchangeExternal) + if err != nil { + return nil, fmt.Errorf("cannot parse dataExchangeRef for listing ref: %w", err) + } + + deID := dataExchangeID.ID() + id.parent = &BigQueryAnalyticsHubListingParent{ProjectID: projectID, Location: location, DataExchangeID: deID} + + // Get desired ID + resourceID := valueOf(obj.Spec.ResourceID) + if resourceID == "" { + resourceID = obj.GetName() + } + if resourceID == "" { + return nil, fmt.Errorf("cannot resolve resource ID") + } + if deID == "" { + return nil, fmt.Errorf("cannot resolve dataExchange ID") + } + + // Use approved External + externalRef := valueOf(obj.Status.ExternalRef) + if externalRef == "" { + id.External = asBigQueryAnalyticsHubListingExternal(id.parent, resourceID) + return id, nil + } + + // Validate desired with actual + actualParent, actualResourceID, err := parseBigQueryAnalyticsHubListingExternal(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) + } + if actualParent.DataExchangeID != deID { + return nil, fmt.Errorf("spec.dataExchangeRef changed, expect %s, got %s", actualParent.DataExchangeID, deID) + } + + id.External = externalRef + id.parent = &BigQueryAnalyticsHubListingParent{ProjectID: projectID, Location: location, DataExchangeID: deID} + return id, nil +} + +func (r *BigQueryAnalyticsHubListingRef) Parent() (*BigQueryAnalyticsHubListingParent, error) { + if r.parent != nil { + return r.parent, nil + } + if r.External != "" { + parent, _, err := parseBigQueryAnalyticsHubListingExternal(r.External) + if err != nil { + return nil, err + } + return parent, nil + } + return nil, fmt.Errorf("BigQueryAnalyticsHubListingRef not initialized from `NewBigQueryAnalyticsHubListingRef` or `NormalizedExternal`") +} + +type BigQueryAnalyticsHubListingParent struct { + ProjectID string + Location string + DataExchangeID string +} + +func (p *BigQueryAnalyticsHubListingParent) String() string { + return "projects/" + p.ProjectID + "/locations/" + p.Location + "/dataExchanges/" + p.DataExchangeID +} + +func asBigQueryAnalyticsHubListingExternal(parent *BigQueryAnalyticsHubListingParent, resourceID string) (external string) { + return parent.String() + "/listings/" + resourceID +} + +func parseBigQueryAnalyticsHubListingExternal(external string) (parent *BigQueryAnalyticsHubListingParent, resourceID string, err error) { + external = strings.TrimPrefix(external, "/") + tokens := strings.Split(external, "/") + if len(tokens) != 8 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "dataExchanges" || tokens[6] != "listings" { + return nil, "", fmt.Errorf("format of BigQueryAnalyticsHubListing external=%q was not known (use projects//locations//dataExchanges//listings/)", external) + } + parent = &BigQueryAnalyticsHubListingParent{ + ProjectID: tokens[1], + Location: tokens[3], + DataExchangeID: tokens[5], + } + resourceID = tokens[7] + 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/bigqueryanalyticshub/v1beta1/listing_types.go b/apis/bigqueryanalyticshub/v1beta1/listing_types.go new file mode 100644 index 0000000000..0fe42dff7e --- /dev/null +++ b/apis/bigqueryanalyticshub/v1beta1/listing_types.go @@ -0,0 +1,204 @@ +// 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 v1beta1 + +import ( + refv1beta1 "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 BigQueryAnalyticsHubListingGVK = GroupVersion.WithKind("BigQueryAnalyticsHubListing") + +// +kcc:proto=google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.SelectedResource +type SelectedResource struct { + // Optional. A reference to a BigQueryTable. + // Format: + // `projects/{projectId}/datasets/{datasetId}/tables/{tableId}` + // Example:"projects/test_project/datasets/test_dataset/tables/test_table" + TableRef *refv1beta1.BigQueryTableRef `json:"tableRef,omitempty"` +} + +type BigQueryDatasetSource struct { + // +required + // Resource name of the dataset source for this listing. + // e.g. `projects/myproject/datasets/123` + DatasetRef *refv1beta1.BigQueryDatasetRef `json:"datasetRef,omitempty"` + + // Optional. Resources in this dataset that are selectively shared. + // If this field is empty, then the entire dataset (all resources) are + // shared. This field is only valid for data clean room exchanges. + SelectedResources []SelectedResource `json:"selectedResources,omitempty"` + + // Optional. If set, restricted export policy will be propagated and + // enforced on the linked dataset. + RestrictedExportPolicy *RestrictedExportPolicy `json:"restrictedExportPolicy,omitempty"` +} + +// +kcc:proto=google.cloud.bigquery.analyticshub.v1.Listing.BigQueryDatasetSource.RestrictedExportPolicy +type RestrictedExportPolicy struct { + // Optional. If true, enable restricted export. + Enabled *bool `json:"enabled,omitempty"` + + // Optional. If true, restrict direct table access (read + // api/tabledata.list) on linked table. + RestrictDirectTableAccess *bool `json:"restrictDirectTableAccess,omitempty"` + + // Optional. If true, restrict export of query result derived from + // restricted linked dataset table. + RestrictQueryResult *bool `json:"restrictQueryResult,omitempty"` +} + +type Source struct { + // One of the following fields must be set. + BigQueryDatasetSource *BigQueryDatasetSource `json:"bigQueryDatasetSource,omitempty"` + + // NOT YET + // PubsubTopicSource *PubsubTopicSource `json:"pubsubTopicSource,omitempty"` +} + +// BigQueryAnalyticsHubListingSpec defines the desired state of BigQueryAnalyticsHubDataExchangeListing +// +kcc:proto=google.cloud.bigquery.analyticshub.v1.Listing +type BigQueryAnalyticsHubListingSpec struct { + // +required + Source *Source `json:"source,omitempty"` + + // +required + // Required. Human-readable display name of the listing. The display name must + // contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), + // spaces ( ), ampersands (&) and can't start or end with spaces. Default + // value is an empty string. Max length: 63 bytes. + DisplayName *string `json:"displayName,omitempty"` + + // Optional. Short description of the listing. The description must contain only + // Unicode characters or tabs (HT), new lines (LF), carriage returns (CR), and + // page breaks (FF). Default value is an empty string. Max length: 2000 bytes. + Description *string `json:"description,omitempty"` + + // Optional. Email or URL of the primary point of contact of the listing. + // Max Length: 1000 bytes. + PrimaryContact *string `json:"primaryContact,omitempty"` + + // Optional. Documentation describing the listing. + Documentation *string `json:"documentation,omitempty"` + + // Optional. Details of the data provider who owns the source data. + DataProvider *DataProvider `json:"dataProvider,omitempty"` + + // Optional. Categories of the listing. Up to two categories are allowed. + Categories []string `json:"categories,omitempty"` + + // Optional. Details of the publisher who owns the listing and who can share + // the source data. + Publisher *Publisher `json:"publisher,omitempty"` + + // Optional. Email or URL of the request access of the listing. + // Subscribers can use this reference to request access. + // Max Length: 1000 bytes. + RequestAccess *string `json:"requestAccess,omitempty"` + + // Not yet + // // Optional. If set, restricted export configuration will be propagated and + // // enforced on the linked dataset. + // RestrictedExportConfig *Listing_RestrictedExportConfig `json:"restrictedExportConfig,omitempty"` + + // Optional. Type of discovery of the listing on the discovery page. + DiscoveryType *string `json:"discoveryType,omitempty"` + + // Not yet + // // Optional. Base64 encoded image representing the listing. Max Size: 3.0MiB + // // Expected image dimensions are 512x512 pixels, however the API only + // // performs validation on size of the encoded data. + // // Note: For byte fields, the contents of the field are base64-encoded (which + // // increases the size of the data by 33-36%) when using JSON on the wire. + // Icon []byte `json:"icon,omitempty"` + + /* Immutable. The name of the location this data exchange. */ + // +required + Location string `json:"location"` + + // +required + ProjectRef *refv1beta1.ProjectRef `json:"projectRef"` + + // +required + DataExchangeRef *BigQueryAnalyticsHubDataExchangeRef `json:"dataExchangeRef"` + + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ResourceID field is immutable" + // Immutable. + // The BigQueryAnalyticsHubDataExchangeListing name. If not given, the metadata.name will be used. + // + optional + ResourceID *string `json:"resourceID,omitempty"` +} + +// BigQueryAnalyticsHubListingStatus defines the config connector machine state of BigQueryAnalyticsHubDataExchangeListing +type BigQueryAnalyticsHubListingStatus 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 BigQueryAnalyticsHubDataExchangeListing resource in GCP. + ExternalRef *string `json:"externalRef,omitempty"` + + // ObservedState is the state of the resource as most recently observed in GCP. + ObservedState *BigQueryAnalyticsHubListingObservedState `json:"observedState,omitempty"` +} + +// BigQueryAnalyticsHubDataExchangeListingSpec defines the desired state of BigQueryAnalyticsHubDataExchangeListing +// +kcc:proto=google.cloud.bigquery.analyticshub.v1.Listing +type BigQueryAnalyticsHubListingObservedState struct { + // This field is in the same format as our externalRef! So it's redundant. + // // Output only. The resource name of the data exchange. + // // e.g. `projects/myproject/locations/US/dataExchanges/123/listing/456`. + // Name *string `json:"name,omitempty"` + + // Output only. Current state of the listing. + State *string `json:"state,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:categories=gcp +// +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'" + +// BigQueryAnalyticsHubListing is the Schema for the BigQueryAnalyticsHubListing API +// +k8s:openapi-gen=true +// +kubebuilder:storageversion +type BigQueryAnalyticsHubListing struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BigQueryAnalyticsHubListingSpec `json:"spec,omitempty"` + Status BigQueryAnalyticsHubListingStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// BigQueryAnalyticsHubListingList contains a list of BigQueryAnalyticsHubDataExchangeListing +type BigQueryAnalyticsHubListingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []BigQueryAnalyticsHubListing `json:"items"` +} + +func init() { + SchemeBuilder.Register(&BigQueryAnalyticsHubListing{}, &BigQueryAnalyticsHubListingList{}) +} diff --git a/apis/bigqueryanalyticshub/v1beta1/zz_generated.deepcopy.go b/apis/bigqueryanalyticshub/v1beta1/zz_generated.deepcopy.go index 9fe4972a93..61c2577289 100644 --- a/apis/bigqueryanalyticshub/v1beta1/zz_generated.deepcopy.go +++ b/apis/bigqueryanalyticshub/v1beta1/zz_generated.deepcopy.go @@ -203,6 +203,267 @@ func (in *BigQueryAnalyticsHubDataExchangeStatus) DeepCopy() *BigQueryAnalyticsH return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BigQueryAnalyticsHubListing) DeepCopyInto(out *BigQueryAnalyticsHubListing) { + *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 BigQueryAnalyticsHubListing. +func (in *BigQueryAnalyticsHubListing) DeepCopy() *BigQueryAnalyticsHubListing { + if in == nil { + return nil + } + out := new(BigQueryAnalyticsHubListing) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BigQueryAnalyticsHubListing) 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 *BigQueryAnalyticsHubListingList) DeepCopyInto(out *BigQueryAnalyticsHubListingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]BigQueryAnalyticsHubListing, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryAnalyticsHubListingList. +func (in *BigQueryAnalyticsHubListingList) DeepCopy() *BigQueryAnalyticsHubListingList { + if in == nil { + return nil + } + out := new(BigQueryAnalyticsHubListingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BigQueryAnalyticsHubListingList) 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 *BigQueryAnalyticsHubListingObservedState) DeepCopyInto(out *BigQueryAnalyticsHubListingObservedState) { + *out = *in + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryAnalyticsHubListingObservedState. +func (in *BigQueryAnalyticsHubListingObservedState) DeepCopy() *BigQueryAnalyticsHubListingObservedState { + if in == nil { + return nil + } + out := new(BigQueryAnalyticsHubListingObservedState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BigQueryAnalyticsHubListingParent) DeepCopyInto(out *BigQueryAnalyticsHubListingParent) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryAnalyticsHubListingParent. +func (in *BigQueryAnalyticsHubListingParent) DeepCopy() *BigQueryAnalyticsHubListingParent { + if in == nil { + return nil + } + out := new(BigQueryAnalyticsHubListingParent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BigQueryAnalyticsHubListingRef) DeepCopyInto(out *BigQueryAnalyticsHubListingRef) { + *out = *in + if in.parent != nil { + in, out := &in.parent, &out.parent + *out = new(BigQueryAnalyticsHubListingParent) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryAnalyticsHubListingRef. +func (in *BigQueryAnalyticsHubListingRef) DeepCopy() *BigQueryAnalyticsHubListingRef { + if in == nil { + return nil + } + out := new(BigQueryAnalyticsHubListingRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BigQueryAnalyticsHubListingSpec) DeepCopyInto(out *BigQueryAnalyticsHubListingSpec) { + *out = *in + if in.Source != nil { + in, out := &in.Source, &out.Source + *out = new(Source) + (*in).DeepCopyInto(*out) + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.PrimaryContact != nil { + in, out := &in.PrimaryContact, &out.PrimaryContact + *out = new(string) + **out = **in + } + if in.Documentation != nil { + in, out := &in.Documentation, &out.Documentation + *out = new(string) + **out = **in + } + if in.DataProvider != nil { + in, out := &in.DataProvider, &out.DataProvider + *out = new(DataProvider) + (*in).DeepCopyInto(*out) + } + if in.Categories != nil { + in, out := &in.Categories, &out.Categories + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Publisher != nil { + in, out := &in.Publisher, &out.Publisher + *out = new(Publisher) + (*in).DeepCopyInto(*out) + } + if in.RequestAccess != nil { + in, out := &in.RequestAccess, &out.RequestAccess + *out = new(string) + **out = **in + } + if in.DiscoveryType != nil { + in, out := &in.DiscoveryType, &out.DiscoveryType + *out = new(string) + **out = **in + } + if in.ProjectRef != nil { + in, out := &in.ProjectRef, &out.ProjectRef + *out = new(refsv1beta1.ProjectRef) + **out = **in + } + if in.DataExchangeRef != nil { + in, out := &in.DataExchangeRef, &out.DataExchangeRef + *out = new(BigQueryAnalyticsHubDataExchangeRef) + **out = **in + } + if in.ResourceID != nil { + in, out := &in.ResourceID, &out.ResourceID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryAnalyticsHubListingSpec. +func (in *BigQueryAnalyticsHubListingSpec) DeepCopy() *BigQueryAnalyticsHubListingSpec { + if in == nil { + return nil + } + out := new(BigQueryAnalyticsHubListingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BigQueryAnalyticsHubListingStatus) DeepCopyInto(out *BigQueryAnalyticsHubListingStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1alpha1.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(BigQueryAnalyticsHubListingObservedState) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryAnalyticsHubListingStatus. +func (in *BigQueryAnalyticsHubListingStatus) DeepCopy() *BigQueryAnalyticsHubListingStatus { + if in == nil { + return nil + } + out := new(BigQueryAnalyticsHubListingStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BigQueryDatasetSource) DeepCopyInto(out *BigQueryDatasetSource) { + *out = *in + if in.DatasetRef != nil { + in, out := &in.DatasetRef, &out.DatasetRef + *out = new(refsv1beta1.BigQueryDatasetRef) + **out = **in + } + if in.SelectedResources != nil { + in, out := &in.SelectedResources, &out.SelectedResources + *out = make([]SelectedResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.RestrictedExportPolicy != nil { + in, out := &in.RestrictedExportPolicy, &out.RestrictedExportPolicy + *out = new(RestrictedExportPolicy) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryDatasetSource. +func (in *BigQueryDatasetSource) DeepCopy() *BigQueryDatasetSource { + if in == nil { + return nil + } + out := new(BigQueryDatasetSource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BoolValue) DeepCopyInto(out *BoolValue) { *out = *in @@ -560,6 +821,56 @@ func (in *Publisher) DeepCopy() *Publisher { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RestrictedExportPolicy) DeepCopyInto(out *RestrictedExportPolicy) { + *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } + if in.RestrictDirectTableAccess != nil { + in, out := &in.RestrictDirectTableAccess, &out.RestrictDirectTableAccess + *out = new(bool) + **out = **in + } + if in.RestrictQueryResult != nil { + in, out := &in.RestrictQueryResult, &out.RestrictQueryResult + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RestrictedExportPolicy. +func (in *RestrictedExportPolicy) DeepCopy() *RestrictedExportPolicy { + if in == nil { + return nil + } + out := new(RestrictedExportPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SelectedResource) DeepCopyInto(out *SelectedResource) { + *out = *in + if in.TableRef != nil { + in, out := &in.TableRef, &out.TableRef + *out = new(refsv1beta1.BigQueryTableRef) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SelectedResource. +func (in *SelectedResource) DeepCopy() *SelectedResource { + if in == nil { + return nil + } + out := new(SelectedResource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SharingEnvironmentConfig) DeepCopyInto(out *SharingEnvironmentConfig) { *out = *in @@ -624,3 +935,23 @@ func (in *SharingEnvironmentConfig_DefaultExchangeConfig) DeepCopy() *SharingEnv in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Source) DeepCopyInto(out *Source) { + *out = *in + if in.BigQueryDatasetSource != nil { + in, out := &in.BigQueryDatasetSource, &out.BigQueryDatasetSource + *out = new(BigQueryDatasetSource) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Source. +func (in *Source) DeepCopy() *Source { + if in == nil { + return nil + } + out := new(Source) + in.DeepCopyInto(out) + return out +} diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigqueryanalyticshublistings.bigqueryanalyticshub.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigqueryanalyticshublistings.bigqueryanalyticshub.cnrm.cloud.google.com.yaml index 488a6443ed..16c73ab750 100644 --- a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigqueryanalyticshublistings.bigqueryanalyticshub.cnrm.cloud.google.com.yaml +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigqueryanalyticshublistings.bigqueryanalyticshub.cnrm.cloud.google.com.yaml @@ -345,6 +345,334 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - 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: v1beta1 + schema: + openAPIV3Schema: + description: BigQueryAnalyticsHubListing is the Schema for the BigQueryAnalyticsHubListing + 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: BigQueryAnalyticsHubListingSpec defines the desired state + of BigQueryAnalyticsHubDataExchangeListing + properties: + categories: + description: Optional. Categories of the listing. Up to two categories + are allowed. + items: + type: string + type: array + dataExchangeRef: + description: BigQueryAnalyticsHubDataExchangeRef defines the resource + reference to BigQueryAnalyticsHubDataExchange, which "External" + field holds the GCP identifier for the KRM object. + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: A reference to an externally managed BigQueryAnalyticsHubDataExchange + resource. Should be in the format "projects//locations//dataexchanges/". + type: string + name: + description: The name of a BigQueryAnalyticsHubDataExchange resource. + type: string + namespace: + description: The namespace of a BigQueryAnalyticsHubDataExchange + resource. + type: string + type: object + dataProvider: + description: Optional. Details of the data provider who owns the source + data. + properties: + name: + description: Optional. Name of the data provider. + type: string + primaryContact: + description: 'Optional. Email or URL of the data provider. Max + Length: 1000 bytes.' + type: string + type: object + description: + description: 'Optional. Short description of the listing. The description + must contain only Unicode characters or tabs (HT), new lines (LF), + carriage returns (CR), and page breaks (FF). Default value is an + empty string. Max length: 2000 bytes.' + type: string + discoveryType: + description: Optional. Type of discovery of the listing on the discovery + page. + type: string + displayName: + description: 'Required. Human-readable display name of the listing. + The display name must contain only Unicode letters, numbers (0-9), + underscores (_), dashes (-), spaces ( ), ampersands (&) and can''t + start or end with spaces. Default value is an empty string. Max + length: 63 bytes.' + type: string + documentation: + description: Optional. Documentation describing the listing. + type: string + location: + description: Immutable. The name of the location this data exchange. + type: string + primaryContact: + description: 'Optional. Email or URL of the primary point of contact + of the listing. Max Length: 1000 bytes.' + type: string + projectRef: + description: The Project that this resource belongs to. + 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 + publisher: + description: Optional. Details of the publisher who owns the listing + and who can share the source data. + properties: + name: + description: Optional. Name of the listing publisher. + type: string + primaryContact: + description: 'Optional. Email or URL of the listing publisher. + Max Length: 1000 bytes.' + type: string + type: object + requestAccess: + description: 'Optional. Email or URL of the request access of the + listing. Subscribers can use this reference to request access. Max + Length: 1000 bytes.' + type: string + resourceID: + description: Immutable. The BigQueryAnalyticsHubDataExchangeListing + name. If not given, the metadata.name will be used. + type: string + x-kubernetes-validations: + - message: ResourceID field is immutable + rule: self == oldSelf + source: + properties: + bigQueryDatasetSource: + description: One of the following fields must be set. + properties: + datasetRef: + description: Resource name of the dataset source for this + listing. e.g. `projects/myproject/datasets/123` + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: If provided must be in the format `projects/[project_id]/datasets/[dataset_id]`. + type: string + name: + description: The `metadata.name` field of a `BigQueryDataset` + resource. + type: string + namespace: + description: The `metadata.namespace` field of a `BigQueryDataset` + resource. + type: string + type: object + restrictedExportPolicy: + description: Optional. If set, restricted export policy will + be propagated and enforced on the linked dataset. + properties: + enabled: + description: Optional. If true, enable restricted export. + type: boolean + restrictDirectTableAccess: + description: Optional. If true, restrict direct table + access (read api/tabledata.list) on linked table. + type: boolean + restrictQueryResult: + description: Optional. If true, restrict export of query + result derived from restricted linked dataset table. + type: boolean + type: object + selectedResources: + description: Optional. Resources in this dataset that are + selectively shared. If this field is empty, then the entire + dataset (all resources) are shared. This field is only valid + for data clean room exchanges. + items: + properties: + tableRef: + description: 'Optional. A reference to a BigQueryTable. + Format: `projects/{projectId}/datasets/{datasetId}/tables/{tableId}` + Example:"projects/test_project/datasets/test_dataset/tables/test_table"' + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: If provided must be in the format `projects/{projectId}/datasets/{datasetId}/tables/{tableId}`. + type: string + name: + description: The `metadata.name` field of a `BigQueryTable` + resource. + type: string + namespace: + description: The `metadata.namespace` field of a + `BigQueryTable` resource. + type: string + type: object + type: object + type: array + required: + - datasetRef + type: object + type: object + required: + - dataExchangeRef + - displayName + - location + - projectRef + - source + type: object + status: + description: BigQueryAnalyticsHubListingStatus defines the config connector + machine state of BigQueryAnalyticsHubDataExchangeListing + 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 BigQueryAnalyticsHubDataExchangeListing + 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: + state: + description: Output only. Current state of the listing. + type: string + type: object + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/config/samples/resources/bigqueryanalyticshublisting/bigquery_v1beta1_bigquerydataset.yaml b/config/samples/resources/bigqueryanalyticshublisting/bigquery_v1beta1_bigquerydataset.yaml new file mode 100644 index 0000000000..742626fbe1 --- /dev/null +++ b/config/samples/resources/bigqueryanalyticshublisting/bigquery_v1beta1_bigquerydataset.yaml @@ -0,0 +1,20 @@ +# 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. + +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + name: bigqueryanalyticshublisting-dep +spec: + friendlyName: my-bigquerydataset diff --git a/config/samples/resources/bigqueryanalyticshublisting/bigqueryanalyticshub_v1beta1_bigqueryanalyticshubdataexchange.yaml b/config/samples/resources/bigqueryanalyticshublisting/bigqueryanalyticshub_v1beta1_bigqueryanalyticshubdataexchange.yaml new file mode 100644 index 0000000000..9253b4fd09 --- /dev/null +++ b/config/samples/resources/bigqueryanalyticshublisting/bigqueryanalyticshub_v1beta1_bigqueryanalyticshubdataexchange.yaml @@ -0,0 +1,23 @@ +# 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. + +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 +kind: BigQueryAnalyticsHubDataExchange +metadata: + name: bigqueryanalyticshublistingdep +spec: + displayName: my_data_exchange + location: US + projectRef: + external: ${PROJECT_ID?} \ No newline at end of file diff --git a/config/samples/resources/bigqueryanalyticshublisting/bigqueryanalyticshub_v1beta1_bigqueryanalyticshublisting.yaml b/config/samples/resources/bigqueryanalyticshublisting/bigqueryanalyticshub_v1beta1_bigqueryanalyticshublisting.yaml new file mode 100644 index 0000000000..eec8e09fbd --- /dev/null +++ b/config/samples/resources/bigqueryanalyticshublisting/bigqueryanalyticshub_v1beta1_bigqueryanalyticshublisting.yaml @@ -0,0 +1,29 @@ +# 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. + +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 +kind: BigQueryAnalyticsHubListing +metadata: + name: bigqueryanalyticshublistingsample +spec: + displayName: my_listing + location: US + source: + bigQueryDatasetSource: + datasetRef: + name: bigqueryanalyticshublisting-dep + dataExchangeRef: + name: bigqueryanalyticshublistingdep + projectRef: + external: ${PROJECT_ID?} \ No newline at end of file diff --git a/config/servicemappings/bigqueryanalyticshub.yaml b/config/servicemappings/bigqueryanalyticshub.yaml index 4e52eb9763..4513067736 100644 --- a/config/servicemappings/bigqueryanalyticshub.yaml +++ b/config/servicemappings/bigqueryanalyticshub.yaml @@ -24,4 +24,7 @@ spec: resources: - name: google_bigquery_analytics_hub_data_exchange kind: BigQueryAnalyticsHubDataExchange + direct: true + - name: google_bigquery_analytics_hub_listing + kind: BigQueryAnalyticsHubListing direct: true \ No newline at end of file diff --git a/pkg/controller/direct/bigqueryanalyticshub/listing_controller.go b/pkg/controller/direct/bigqueryanalyticshub/listing_controller.go index 183bc69254..3c24509d52 100644 --- a/pkg/controller/direct/bigqueryanalyticshub/listing_controller.go +++ b/pkg/controller/direct/bigqueryanalyticshub/listing_controller.go @@ -19,7 +19,7 @@ import ( "fmt" "reflect" - krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/bigqueryanalyticshub/v1alpha1" + krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/bigqueryanalyticshub/v1beta1" refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/config" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct" diff --git a/pkg/controller/direct/bigqueryanalyticshub/mapper.go b/pkg/controller/direct/bigqueryanalyticshub/mapper.go index 6d56967378..7e3e553241 100644 --- a/pkg/controller/direct/bigqueryanalyticshub/mapper.go +++ b/pkg/controller/direct/bigqueryanalyticshub/mapper.go @@ -16,28 +16,27 @@ package bigqueryanalyticshub import ( pb "cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb" - krmv1alpha1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/bigqueryanalyticshub/v1alpha1" - krmv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/bigqueryanalyticshub/v1beta1" + krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/bigqueryanalyticshub/v1beta1" refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct" "google.golang.org/protobuf/types/known/wrapperspb" ) -func BigQueryAnalyticsHubDataExchangeObservedState_FromProto(mapCtx *direct.MapContext, in *pb.DataExchange) *krmv1beta1.BigQueryAnalyticsHubDataExchangeObservedState { +func BigQueryAnalyticsHubDataExchangeObservedState_FromProto(mapCtx *direct.MapContext, in *pb.DataExchange) *krm.BigQueryAnalyticsHubDataExchangeObservedState { if in == nil { return nil } - out := &krmv1beta1.BigQueryAnalyticsHubDataExchangeObservedState{} + out := &krm.BigQueryAnalyticsHubDataExchangeObservedState{} out.ListingCount = direct.LazyPtr(int64(in.GetListingCount())) // MISSING: SharingEnvironmentConfig // not yet return out } -func BigQueryAnalyticsHubDataExchangeSpec_FromProto(mapCtx *direct.MapContext, in *pb.DataExchange) *krmv1beta1.BigQueryAnalyticsHubDataExchangeSpec { +func BigQueryAnalyticsHubDataExchangeSpec_FromProto(mapCtx *direct.MapContext, in *pb.DataExchange) *krm.BigQueryAnalyticsHubDataExchangeSpec { if in == nil { return nil } - out := &krmv1beta1.BigQueryAnalyticsHubDataExchangeSpec{} + out := &krm.BigQueryAnalyticsHubDataExchangeSpec{} out.DisplayName = direct.LazyPtr(in.GetDisplayName()) out.Description = direct.LazyPtr(in.GetDescription()) out.PrimaryContact = direct.LazyPtr(in.GetPrimaryContact()) @@ -48,7 +47,7 @@ func BigQueryAnalyticsHubDataExchangeSpec_FromProto(mapCtx *direct.MapContext, i out.DiscoveryType = direct.Enum_FromProto(mapCtx, in.GetDiscoveryType()) return out } -func BigQueryAnalyticsHubDataExchangeSpec_ToProto(mapCtx *direct.MapContext, in *krmv1beta1.BigQueryAnalyticsHubDataExchangeSpec) *pb.DataExchange { +func BigQueryAnalyticsHubDataExchangeSpec_ToProto(mapCtx *direct.MapContext, in *krm.BigQueryAnalyticsHubDataExchangeSpec) *pb.DataExchange { if in == nil { return nil } @@ -81,11 +80,11 @@ func Categories_FromProto(mapCtx *direct.MapContext, in []pb.Listing_Category) [ return ret } -func BigQueryAnalyticsHubListingSpec_FromProto(mapCtx *direct.MapContext, in *pb.Listing) *krmv1alpha1.BigQueryAnalyticsHubListingSpec { +func BigQueryAnalyticsHubListingSpec_FromProto(mapCtx *direct.MapContext, in *pb.Listing) *krm.BigQueryAnalyticsHubListingSpec { if in == nil { return nil } - out := &krmv1alpha1.BigQueryAnalyticsHubListingSpec{} + out := &krm.BigQueryAnalyticsHubListingSpec{} out.DisplayName = direct.LazyPtr(in.GetDisplayName()) out.Description = direct.LazyPtr(in.GetDescription()) @@ -99,18 +98,18 @@ func BigQueryAnalyticsHubListingSpec_FromProto(mapCtx *direct.MapContext, in *pb // MISSING: RestrictedExportConfig // not yet out.DiscoveryType = direct.Enum_FromProto(mapCtx, in.GetDiscoveryType()) - out.Source = &krmv1alpha1.Source{ + out.Source = &krm.Source{ // TODO(KCC): in the future enforce mutual exclusion / one of b/w BigQueryDatasetSource and PubSubTopicSource BigQueryDatasetSource: Listing_BigQueryDatasetSource_FromProto(mapCtx, in.GetBigqueryDataset()), } return out } -func Listing_BigQueryDatasetSource_FromProto(mapCtx *direct.MapContext, in *pb.Listing_BigQueryDatasetSource) *krmv1alpha1.BigQueryDatasetSource { +func Listing_BigQueryDatasetSource_FromProto(mapCtx *direct.MapContext, in *pb.Listing_BigQueryDatasetSource) *krm.BigQueryDatasetSource { if in == nil { return nil } - out := &krmv1alpha1.BigQueryDatasetSource{} + out := &krm.BigQueryDatasetSource{} if out.DatasetRef != nil { out.DatasetRef = &refs.BigQueryDatasetRef{ External: in.Dataset, @@ -122,11 +121,11 @@ func Listing_BigQueryDatasetSource_FromProto(mapCtx *direct.MapContext, in *pb.L return out } -func Listing_BigQueryDatasetSource_SelectedResource_FromProto(mapCtx *direct.MapContext, in *pb.Listing_BigQueryDatasetSource_SelectedResource) *krmv1alpha1.SelectedResource { +func Listing_BigQueryDatasetSource_SelectedResource_FromProto(mapCtx *direct.MapContext, in *pb.Listing_BigQueryDatasetSource_SelectedResource) *krm.SelectedResource { if in == nil { return nil } - out := &krmv1alpha1.SelectedResource{} + out := &krm.SelectedResource{} if in.GetTable() != "" { out.TableRef = &refs.BigQueryTableRef{ External: in.GetTable(), @@ -135,7 +134,7 @@ func Listing_BigQueryDatasetSource_SelectedResource_FromProto(mapCtx *direct.Map return out } -func Listing_BigQueryDatasetSource_SelectedResource_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.SelectedResource) *pb.Listing_BigQueryDatasetSource_SelectedResource { +func Listing_BigQueryDatasetSource_SelectedResource_ToProto(mapCtx *direct.MapContext, in *krm.SelectedResource) *pb.Listing_BigQueryDatasetSource_SelectedResource { if in == nil { return nil } @@ -149,11 +148,11 @@ func Listing_BigQueryDatasetSource_SelectedResource_ToProto(mapCtx *direct.MapCo return out } -func Listing_BigQueryDatasetSource_RestrictedExportPolicy_FromProto(mapCtx *direct.MapContext, in *pb.Listing_BigQueryDatasetSource_RestrictedExportPolicy) *krmv1alpha1.RestrictedExportPolicy { +func Listing_BigQueryDatasetSource_RestrictedExportPolicy_FromProto(mapCtx *direct.MapContext, in *pb.Listing_BigQueryDatasetSource_RestrictedExportPolicy) *krm.RestrictedExportPolicy { if in == nil { return nil } - out := &krmv1alpha1.RestrictedExportPolicy{} + out := &krm.RestrictedExportPolicy{} if in.GetEnabled() != nil { out.Enabled = direct.LazyPtr(in.GetEnabled().GetValue()) } @@ -166,7 +165,7 @@ func Listing_BigQueryDatasetSource_RestrictedExportPolicy_FromProto(mapCtx *dire return out } -func Listing_BigQueryDatasetSource_RestrictedExportPolicy_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.RestrictedExportPolicy) *pb.Listing_BigQueryDatasetSource_RestrictedExportPolicy { +func Listing_BigQueryDatasetSource_RestrictedExportPolicy_ToProto(mapCtx *direct.MapContext, in *krm.RestrictedExportPolicy) *pb.Listing_BigQueryDatasetSource_RestrictedExportPolicy { if in == nil { return nil } @@ -184,18 +183,18 @@ func Listing_BigQueryDatasetSource_RestrictedExportPolicy_ToProto(mapCtx *direct return out } -func BigQueryAnalyticsHubListingObservedState_FromProto(mapCtx *direct.MapContext, in *pb.Listing) *krmv1alpha1.BigQueryAnalyticsHubListingObservedState { +func BigQueryAnalyticsHubListingObservedState_FromProto(mapCtx *direct.MapContext, in *pb.Listing) *krm.BigQueryAnalyticsHubListingObservedState { if in == nil { return nil } - out := &krmv1alpha1.BigQueryAnalyticsHubListingObservedState{} + out := &krm.BigQueryAnalyticsHubListingObservedState{} out.State = direct.Enum_FromProto(mapCtx, in.GetState()) // MISSING: Icon // not yet // MISSING: RestrictedExportConfig // not yet return out } -func BigQueryAnalyticsHubListingObservedState_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.BigQueryAnalyticsHubListingObservedState) *pb.Listing { +func BigQueryAnalyticsHubListingObservedState_ToProto(mapCtx *direct.MapContext, in *krm.BigQueryAnalyticsHubListingObservedState) *pb.Listing { if in == nil { return nil } @@ -219,7 +218,7 @@ func Categories_ToProto(mapCtx *direct.MapContext, in []string) []pb.Listing_Cat return ret } -func BigQueryAnalyticsHubListingSpec_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.BigQueryAnalyticsHubListingSpec) *pb.Listing { +func BigQueryAnalyticsHubListingSpec_ToProto(mapCtx *direct.MapContext, in *krm.BigQueryAnalyticsHubListingSpec) *pb.Listing { if in == nil { return nil } @@ -248,7 +247,7 @@ func BigQueryAnalyticsHubListingSpec_ToProto(mapCtx *direct.MapContext, in *krmv return out } -func Listing_BigQueryDatasetSource_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.BigQueryDatasetSource) *pb.Listing_BigqueryDataset { +func Listing_BigQueryDatasetSource_ToProto(mapCtx *direct.MapContext, in *krm.BigQueryDatasetSource) *pb.Listing_BigqueryDataset { if in == nil { return nil } @@ -281,17 +280,17 @@ func Listing_BigQueryDatasetSource_ToProto(mapCtx *direct.MapContext, in *krmv1a return out } -func DataProvider_FromProto(mapCtx *direct.MapContext, in *pb.DataProvider) *krmv1alpha1.DataProvider { +func DataProvider_FromProto(mapCtx *direct.MapContext, in *pb.DataProvider) *krm.DataProvider { if in == nil { return nil } - out := &krmv1alpha1.DataProvider{} + out := &krm.DataProvider{} out.Name = direct.LazyPtr(in.GetName()) out.PrimaryContact = direct.LazyPtr(in.GetPrimaryContact()) return out } -func DataProvider_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.DataProvider) *pb.DataProvider { +func DataProvider_ToProto(mapCtx *direct.MapContext, in *krm.DataProvider) *pb.DataProvider { if in == nil { return nil } @@ -301,17 +300,17 @@ func DataProvider_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.DataProvide return out } -func Publisher_FromProto(mapCtx *direct.MapContext, in *pb.Publisher) *krmv1alpha1.Publisher { +func Publisher_FromProto(mapCtx *direct.MapContext, in *pb.Publisher) *krm.Publisher { if in == nil { return nil } - out := &krmv1alpha1.Publisher{} + out := &krm.Publisher{} out.Name = direct.LazyPtr(in.GetName()) out.PrimaryContact = direct.LazyPtr(in.GetPrimaryContact()) return out } -func Publisher_ToProto(mapCtx *direct.MapContext, in *krmv1alpha1.Publisher) *pb.Publisher { +func Publisher_ToProto(mapCtx *direct.MapContext, in *krm.Publisher) *pb.Publisher { if in == nil { return nil } diff --git a/pkg/gvks/supportedgvks/gvks_generated.go b/pkg/gvks/supportedgvks/gvks_generated.go index 34aac17a52..0c2de2f8ab 100644 --- a/pkg/gvks/supportedgvks/gvks_generated.go +++ b/pkg/gvks/supportedgvks/gvks_generated.go @@ -499,6 +499,16 @@ var SupportedGVKs = map[schema.GroupVersionKind]GVKMetadata{ "cnrm.cloud.google.com/system": "true", }, }, + { + Group: "bigqueryanalyticshub.cnrm.cloud.google.com", + Version: "v1beta1", + Kind: "BigQueryAnalyticsHubListing", + }: { + Labels: map[string]string{ + "cnrm.cloud.google.com/managed-by-kcc": "true", + "cnrm.cloud.google.com/system": "true", + }, + }, { Group: "bigqueryconnection.cnrm.cloud.google.com", Version: "v1alpha1", diff --git a/pkg/test/resourcefixture/sets.go b/pkg/test/resourcefixture/sets.go index 1b2793be9c..4305f28a6e 100644 --- a/pkg/test/resourcefixture/sets.go +++ b/pkg/test/resourcefixture/sets.go @@ -97,6 +97,7 @@ func IsPureDirectResource(gk schema.GroupKind) bool { "PrivilegedAccessManagerEntitlement", "RedisCluster", "BigQueryAnalyticsHubDataExchange", + "BigQueryAnalyticsHubListing", "WorkstationCluster", "KMSAutokeyConfig", "KMSKeyHandle", diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/_generated_object_bigqueryanalyticshublisting-base.golden.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/_generated_object_bigqueryanalyticshublisting-base.golden.yaml similarity index 94% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/_generated_object_bigqueryanalyticshublisting-base.golden.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/_generated_object_bigqueryanalyticshublisting-base.golden.yaml index b5d022ad35..aaedc990e8 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/_generated_object_bigqueryanalyticshublisting-base.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/_generated_object_bigqueryanalyticshublisting-base.golden.yaml @@ -1,4 +1,4 @@ -apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1 +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 kind: BigQueryAnalyticsHubListing metadata: annotations: diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/_http.log b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/_http.log similarity index 100% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/_http.log rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/_http.log diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/create.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/create.yaml similarity index 93% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/create.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/create.yaml index aa269497cb..3a3e5f77dc 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/create.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1 +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 kind: BigQueryAnalyticsHubListing metadata: name: bigqueryanalyticshublisting${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/dependencies.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/dependencies.yaml similarity index 100% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/dependencies.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/dependencies.yaml diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/update.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/update.yaml similarity index 93% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/update.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/update.yaml index db73571317..aae4e65845 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-base/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-base/update.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1 +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 kind: BigQueryAnalyticsHubListing metadata: name: bigqueryanalyticshublisting${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/_generated_object_bigqueryanalyticshublisting-full.golden.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/_generated_object_bigqueryanalyticshublisting-full.golden.yaml similarity index 95% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/_generated_object_bigqueryanalyticshublisting-full.golden.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/_generated_object_bigqueryanalyticshublisting-full.golden.yaml index 0daf62baad..677ab3379b 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/_generated_object_bigqueryanalyticshublisting-full.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/_generated_object_bigqueryanalyticshublisting-full.golden.yaml @@ -1,4 +1,4 @@ -apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1 +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 kind: BigQueryAnalyticsHubListing metadata: annotations: diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/_http.log b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/_http.log similarity index 100% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/_http.log rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/_http.log diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/_http.log.real b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/_http.log.real similarity index 100% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/_http.log.real rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/_http.log.real diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/create.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/create.yaml similarity index 95% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/create.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/create.yaml index 4ae42ed9e6..94371eced9 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/create.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1 +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 kind: BigQueryAnalyticsHubListing metadata: name: bigqueryanalyticshublisting${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/dependencies.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/dependencies.yaml similarity index 100% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/dependencies.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/dependencies.yaml diff --git a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/update.yaml b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/update.yaml similarity index 95% rename from pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/update.yaml rename to pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/update.yaml index 1b000f8a46..0b2ff54e22 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshublisting-full/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigqueryanalyticshub/v1beta1/bigqueryanalyticshublisting-full/update.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1 +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 kind: BigQueryAnalyticsHubListing metadata: name: bigqueryanalyticshublisting${uniqueId} diff --git a/scripts/generate-google3-docs/resource-reference/_toc.yaml b/scripts/generate-google3-docs/resource-reference/_toc.yaml index 08e13eed77..f0a8434b0d 100644 --- a/scripts/generate-google3-docs/resource-reference/_toc.yaml +++ b/scripts/generate-google3-docs/resource-reference/_toc.yaml @@ -47,6 +47,8 @@ toc: section: - title: "BigQueryAnalyticsHubDataExchange" path: /config-connector/docs/reference/resource-docs/bigqueryanalyticshub/bigqueryanalyticshubdataexchange.md + - title: "BigQueryAnalyticsHubListing" + path: /config-connector/docs/reference/resource-docs/bigqueryanalyticshub/bigqueryanalyticshublisting.md - title: "BigQuery" section: - title: "BigqueryConnectionConnection" diff --git a/scripts/generate-google3-docs/resource-reference/generated/resource-docs/bigqueryanalyticshub/bigqueryanalyticshublisting.md b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/bigqueryanalyticshub/bigqueryanalyticshublisting.md new file mode 100644 index 0000000000..820701542b --- /dev/null +++ b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/bigqueryanalyticshub/bigqueryanalyticshublisting.md @@ -0,0 +1,689 @@ +{# AUTOGENERATED. DO NOT EDIT. #} + +{% extends "config-connector/_base.html" %} + +{% block page_title %}BigQueryAnalyticsHubListing{% endblock %} +{% block body %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyValue
{{gcp_name_short}} Service NameAnalytics Hub
{{gcp_name_short}} Service Documentation/bigquery/docs/query-overview
{{gcp_name_short}} REST Resource Namev1.projects.locations.dataExchanges.listings
{{gcp_name_short}} REST Resource Documentation/bigquery/docs/reference/analytics-hub/rest/v1/projects.locations.dataExchanges.listings
{{product_name_short}} Resource Short Namesbigqueryanalyticshublisting
{{product_name_short}} Service Nameanalyticshub.googleapis.com
{{product_name_short}} Resource Fully Qualified Namebigqueryanalyticshublistings.bigqueryanalyticshub.cnrm.cloud.google.com
Can Be Referenced by IAMPolicy/IAMPolicyMemberNo
{{product_name_short}} Default Average Reconcile Interval In Seconds600
+ +## Custom Resource Definition Properties + + + +### Spec +#### Schema +```yaml +categories: +- string +dataExchangeRef: + external: string + name: string + namespace: string +dataProvider: + name: string + primaryContact: string +description: string +discoveryType: string +displayName: string +documentation: string +location: string +primaryContact: string +projectRef: + external: string + kind: string + name: string + namespace: string +publisher: + name: string + primaryContact: string +requestAccess: string +resourceID: string +source: + bigQueryDatasetSource: + datasetRef: + external: string + name: string + namespace: string + restrictedExportPolicy: + enabled: boolean + restrictDirectTableAccess: boolean + restrictQueryResult: boolean + selectedResources: + - tableRef: + external: string + name: string + namespace: string +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fields
+

categories

+

Optional

+
+

list (string)

+

{% verbatim %}Optional. Categories of the listing. Up to two categories are allowed.{% endverbatim %}

+
+

categories[]

+

Optional

+
+

string

+

{% verbatim %}{% endverbatim %}

+
+

dataExchangeRef

+

Required*

+
+

object

+

{% verbatim %}BigQueryAnalyticsHubDataExchangeRef defines the resource reference to BigQueryAnalyticsHubDataExchange, which "External" field holds the GCP identifier for the KRM object.{% endverbatim %}

+
+

dataExchangeRef.external

+

Optional

+
+

string

+

{% verbatim %}A reference to an externally managed BigQueryAnalyticsHubDataExchange resource. Should be in the format "projects//locations//dataexchanges/".{% endverbatim %}

+
+

dataExchangeRef.name

+

Optional

+
+

string

+

{% verbatim %}The name of a BigQueryAnalyticsHubDataExchange resource.{% endverbatim %}

+
+

dataExchangeRef.namespace

+

Optional

+
+

string

+

{% verbatim %}The namespace of a BigQueryAnalyticsHubDataExchange resource.{% endverbatim %}

+
+

dataProvider

+

Optional

+
+

object

+

{% verbatim %}Optional. Details of the data provider who owns the source data.{% endverbatim %}

+
+

dataProvider.name

+

Optional

+
+

string

+

{% verbatim %}Optional. Name of the data provider.{% endverbatim %}

+
+

dataProvider.primaryContact

+

Optional

+
+

string

+

{% verbatim %}Optional. Email or URL of the data provider. Max Length: 1000 bytes.{% endverbatim %}

+
+

description

+

Optional

+
+

string

+

{% verbatim %}Optional. Short description of the listing. The description must contain only Unicode characters or tabs (HT), new lines (LF), carriage returns (CR), and page breaks (FF). Default value is an empty string. Max length: 2000 bytes.{% endverbatim %}

+
+

discoveryType

+

Optional

+
+

string

+

{% verbatim %}Optional. Type of discovery of the listing on the discovery page.{% endverbatim %}

+
+

displayName

+

Required*

+
+

string

+

{% verbatim %}Required. Human-readable display name of the listing. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string. Max length: 63 bytes.{% endverbatim %}

+
+

documentation

+

Optional

+
+

string

+

{% verbatim %}Optional. Documentation describing the listing.{% endverbatim %}

+
+

location

+

Required*

+
+

string

+

{% verbatim %}Immutable. The name of the location this data exchange.{% endverbatim %}

+
+

primaryContact

+

Optional

+
+

string

+

{% verbatim %}Optional. Email or URL of the primary point of contact of the listing. Max Length: 1000 bytes.{% endverbatim %}

+
+

projectRef

+

Required*

+
+

object

+

{% verbatim %}The Project that this resource belongs to.{% endverbatim %}

+
+

projectRef.external

+

Optional

+
+

string

+

{% verbatim %}The `projectID` field of a project, when not managed by Config Connector.{% endverbatim %}

+
+

projectRef.kind

+

Optional

+
+

string

+

{% verbatim %}The kind of the Project resource; optional but must be `Project` if provided.{% endverbatim %}

+
+

projectRef.name

+

Optional

+
+

string

+

{% verbatim %}The `name` field of a `Project` resource.{% endverbatim %}

+
+

projectRef.namespace

+

Optional

+
+

string

+

{% verbatim %}The `namespace` field of a `Project` resource.{% endverbatim %}

+
+

publisher

+

Optional

+
+

object

+

{% verbatim %}Optional. Details of the publisher who owns the listing and who can share the source data.{% endverbatim %}

+
+

publisher.name

+

Optional

+
+

string

+

{% verbatim %}Optional. Name of the listing publisher.{% endverbatim %}

+
+

publisher.primaryContact

+

Optional

+
+

string

+

{% verbatim %}Optional. Email or URL of the listing publisher. Max Length: 1000 bytes.{% endverbatim %}

+
+

requestAccess

+

Optional

+
+

string

+

{% verbatim %}Optional. Email or URL of the request access of the listing. Subscribers can use this reference to request access. Max Length: 1000 bytes.{% endverbatim %}

+
+

resourceID

+

Optional

+
+

string

+

{% verbatim %}Immutable. The BigQueryAnalyticsHubDataExchangeListing name. If not given, the metadata.name will be used.{% endverbatim %}

+
+

source

+

Required*

+
+

object

+

{% verbatim %}{% endverbatim %}

+
+

source.bigQueryDatasetSource

+

Optional

+
+

object

+

{% verbatim %}One of the following fields must be set.{% endverbatim %}

+
+

source.bigQueryDatasetSource.datasetRef

+

Required*

+
+

object

+

{% verbatim %}Resource name of the dataset source for this listing. e.g. `projects/myproject/datasets/123`{% endverbatim %}

+
+

source.bigQueryDatasetSource.datasetRef.external

+

Optional

+
+

string

+

{% verbatim %}If provided must be in the format `projects/[project_id]/datasets/[dataset_id]`.{% endverbatim %}

+
+

source.bigQueryDatasetSource.datasetRef.name

+

Optional

+
+

string

+

{% verbatim %}The `metadata.name` field of a `BigQueryDataset` resource.{% endverbatim %}

+
+

source.bigQueryDatasetSource.datasetRef.namespace

+

Optional

+
+

string

+

{% verbatim %}The `metadata.namespace` field of a `BigQueryDataset` resource.{% endverbatim %}

+
+

source.bigQueryDatasetSource.restrictedExportPolicy

+

Optional

+
+

object

+

{% verbatim %}Optional. If set, restricted export policy will be propagated and enforced on the linked dataset.{% endverbatim %}

+
+

source.bigQueryDatasetSource.restrictedExportPolicy.enabled

+

Optional

+
+

boolean

+

{% verbatim %}Optional. If true, enable restricted export.{% endverbatim %}

+
+

source.bigQueryDatasetSource.restrictedExportPolicy.restrictDirectTableAccess

+

Optional

+
+

boolean

+

{% verbatim %}Optional. If true, restrict direct table access (read api/tabledata.list) on linked table.{% endverbatim %}

+
+

source.bigQueryDatasetSource.restrictedExportPolicy.restrictQueryResult

+

Optional

+
+

boolean

+

{% verbatim %}Optional. If true, restrict export of query result derived from restricted linked dataset table.{% endverbatim %}

+
+

source.bigQueryDatasetSource.selectedResources

+

Optional

+
+

list (object)

+

{% verbatim %}Optional. Resources in this dataset that are selectively shared. If this field is empty, then the entire dataset (all resources) are shared. This field is only valid for data clean room exchanges.{% endverbatim %}

+
+

source.bigQueryDatasetSource.selectedResources[]

+

Optional

+
+

object

+

{% verbatim %}{% endverbatim %}

+
+

source.bigQueryDatasetSource.selectedResources[].tableRef

+

Optional

+
+

object

+

{% verbatim %}Optional. A reference to a BigQueryTable. Format: `projects/{projectId}/datasets/{datasetId}/tables/{tableId}` Example:"projects/test_project/datasets/test_dataset/tables/test_table"{% endverbatim %}

+
+

source.bigQueryDatasetSource.selectedResources[].tableRef.external

+

Optional

+
+

string

+

{% verbatim %}If provided must be in the format `projects/{projectId}/datasets/{datasetId}/tables/{tableId}`.{% endverbatim %}

+
+

source.bigQueryDatasetSource.selectedResources[].tableRef.name

+

Optional

+
+

string

+

{% verbatim %}The `metadata.name` field of a `BigQueryTable` resource.{% endverbatim %}

+
+

source.bigQueryDatasetSource.selectedResources[].tableRef.namespace

+

Optional

+
+

string

+

{% verbatim %}The `metadata.namespace` field of a `BigQueryTable` resource.{% endverbatim %}

+
+ + +

* Field is required when parent field is specified

+ + +### Status +#### Schema +```yaml +conditions: +- lastTransitionTime: string + message: string + reason: string + status: string + type: string +externalRef: string +observedGeneration: integer +observedState: + state: string +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fields
conditions +

list (object)

+

{% verbatim %}Conditions represent the latest available observations of the object's current state.{% endverbatim %}

+
conditions[] +

object

+

{% verbatim %}{% endverbatim %}

+
conditions[].lastTransitionTime +

string

+

{% verbatim %}Last time the condition transitioned from one status to another.{% endverbatim %}

+
conditions[].message +

string

+

{% verbatim %}Human-readable message indicating details about last transition.{% endverbatim %}

+
conditions[].reason +

string

+

{% verbatim %}Unique, one-word, CamelCase reason for the condition's last transition.{% endverbatim %}

+
conditions[].status +

string

+

{% verbatim %}Status is the status of the condition. Can be True, False, Unknown.{% endverbatim %}

+
conditions[].type +

string

+

{% verbatim %}Type is the type of the condition.{% endverbatim %}

+
externalRef +

string

+

{% verbatim %}A unique specifier for the BigQueryAnalyticsHubDataExchangeListing resource in GCP.{% endverbatim %}

+
observedGeneration +

integer

+

{% verbatim %}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.{% endverbatim %}

+
observedState +

object

+

{% verbatim %}ObservedState is the state of the resource as most recently observed in GCP.{% endverbatim %}

+
observedState.state +

string

+

{% verbatim %}Output only. Current state of the listing.{% endverbatim %}

+
+ +## Sample YAML(s) + +### Typical Use Case +```yaml +# 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. + +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 +kind: BigQueryAnalyticsHubListing +metadata: + name: bigqueryanalyticshublistingsample +spec: + displayName: my_listing + location: US + source: + bigQueryDatasetSource: + datasetRef: + name: bigqueryanalyticshublisting-dep + dataExchangeRef: + name: bigqueryanalyticshublistingdep + projectRef: + external: ${PROJECT_ID?} +--- +apiVersion: bigquery.cnrm.cloud.google.com/v1beta1 +kind: BigQueryDataset +metadata: + name: bigqueryanalyticshublisting-dep +spec: + friendlyName: my-bigquerydataset +--- +apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1beta1 +kind: BigQueryAnalyticsHubDataExchange +metadata: + name: bigqueryanalyticshublistingdep +spec: + displayName: my_data_exchange + location: US + projectRef: + external: ${PROJECT_ID?} +``` + + +Note: If you have any trouble with instantiating the resource, refer to Troubleshoot Config Connector. + +{% endblock %} diff --git a/scripts/generate-google3-docs/resource-reference/overview.md b/scripts/generate-google3-docs/resource-reference/overview.md index 9d036e483f..c4bff67a75 100644 --- a/scripts/generate-google3-docs/resource-reference/overview.md +++ b/scripts/generate-google3-docs/resource-reference/overview.md @@ -77,6 +77,10 @@ issues for {{product_name_short}}. {{analytics_hub_name}} BigQueryAnalyticsHubDataExchange + + {{analytics_hub_name}} + BigQueryAnalyticsHubListing + {{bigquery_name}} diff --git a/scripts/generate-google3-docs/resource-reference/templates/bigqueryanalyticshub_bigqueryanalyticshublisting.tmpl b/scripts/generate-google3-docs/resource-reference/templates/bigqueryanalyticshub_bigqueryanalyticshublisting.tmpl new file mode 100644 index 0000000000..7d39b8e269 --- /dev/null +++ b/scripts/generate-google3-docs/resource-reference/templates/bigqueryanalyticshub_bigqueryanalyticshublisting.tmpl @@ -0,0 +1,54 @@ +{{template "headercomment.tmpl" .}} + +{% extends "config-connector/_base.html" %} + +{% block page_title %}{{ .Kind}}{% endblock %} +{% block body %} +{{template "alphadisclaimer.tmpl" .}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{{template "iamsupport.tmpl" .}} + + + + + +
PropertyValue
{{"{{gcp_name_short}}"}} Service NameAnalytics Hub
{{"{{gcp_name_short}}"}} Service Documentation/bigquery/docs/query-overview
{{"{{gcp_name_short}}"}} REST Resource Namev1.projects.locations.dataExchanges.listings
{{"{{gcp_name_short}}"}} REST Resource Documentation/bigquery/docs/reference/analytics-hub/rest/v1/projects.locations.dataExchanges.listings
{{"{{product_name_short}}"}} Resource Short Names{{ .ShortNames}}
{{"{{product_name_short}}"}} Service Nameanalyticshub.googleapis.com
{{"{{product_name_short}}"}} Resource Fully Qualified Name{{ .FullyQualifiedName}}
{{"{{product_name_short}}"}} Default Average Reconcile Interval In Seconds{{ .DefaultReconcileInterval}}
+ +{{template "resource.tmpl" .}} +{{template "endnote.tmpl" .}} +{% endblock %} diff --git a/scripts/resource-autogen/allowlist/allowlist.go b/scripts/resource-autogen/allowlist/allowlist.go index d26cbbae4a..f467bf24aa 100644 --- a/scripts/resource-autogen/allowlist/allowlist.go +++ b/scripts/resource-autogen/allowlist/allowlist.go @@ -55,7 +55,6 @@ var ( "beyondcorp/google_beyondcorp_app_connector", "beyondcorp/google_beyondcorp_app_gateway", "bigquery/google_bigquery_dataset_access", - "bigquery_analytics_hub/google_bigquery_analytics_hub_listing", "bigquery_datapolicy/google_bigquery_datapolicy_data_policy", "bigquery_reservation/google_bigquery_capacity_commitment", "bigquery_reservation/google_bigquery_reservation",