Skip to content

Commit b4d6fb7

Browse files
Merge pull request GoogleCloudPlatform#2835 from acpana/acpana/bqahde-name
refactor: name field is output only
2 parents b5cc2e9 + 9c97cd5 commit b4d6fb7

File tree

10 files changed

+62
-25
lines changed

10 files changed

+62
-25
lines changed

apis/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshubdataexchange_types.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ var BigQueryAnalyticsHubDataExchangeGVK = GroupVersion.WithKind("BigQueryAnalyti
2626
// BigQueryAnalyticsHubDataExchangeSpec defines the desired state of BigQueryAnalyticsHubDataExchange
2727
// +kcc:proto=google.cloud.bigquery.analyticshub.v1.DataExchange
2828
type BigQueryAnalyticsHubDataExchangeSpec struct {
29-
// Output only. The resource name of the data exchange.
30-
// e.g. `projects/myproject/locations/US/dataExchanges/123`.
31-
Name *string `json:"name,omitempty"`
32-
3329
// Required. Human-readable display name of the data exchange. The display
3430
// name must contain only Unicode letters, numbers (0-9), underscores (_),
3531
// dashes (-), spaces ( ), ampersands (&) and must not start or end with
@@ -100,6 +96,11 @@ type BigQueryAnalyticsHubDataExchangeStatus struct {
10096
// BigQueryAnalyticsHubDataExchangeSpec defines the desired state of BigQueryAnalyticsHubDataExchange
10197
// +kcc:proto=google.cloud.bigquery.analyticshub.v1.DataExchange
10298
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+
103104
/* Number of listings contained in the data exchange. */
104105
// +optional
105106
ListingCount *int64 `json:"listingCount,omitempty"`

apis/bigqueryanalyticshub/v1alpha1/zz_generated.deepcopy.go

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigqueryanalyticshubdataexchanges.bigqueryanalyticshub.cnrm.cloud.google.com.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ spec:
8585
location:
8686
description: Immutable. The name of the location this data exchange.
8787
type: string
88-
name:
89-
description: Output only. The resource name of the data exchange.
90-
e.g. `projects/myproject/locations/US/dataExchanges/123`.
91-
type: string
9288
primaryContact:
9389
description: 'Optional. Email or URL of the primary point of contact
9490
of the data exchange. Max Length: 1000 bytes.'

pkg/clients/generated/apis/bigqueryanalyticshub/v1alpha1/bigqueryanalyticshubdataexchange_types.go

-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/clients/generated/apis/bigqueryanalyticshub/v1alpha1/zz_generated.deepcopy.go

-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/controller/direct/bigqueryanalyticshub/dataexchange_controller.go

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ func (a *Adapter) Update(ctx context.Context, updateOp *directbase.UpdateOperati
233233
if mapCtx.Err() != nil {
234234
return mapCtx.Err()
235235
}
236+
resource.Name = a.actual.Name
236237

237238
req := &bigqueryanalyticshubpb.UpdateDataExchangeRequest{
238239
UpdateMask: updateMask,

pkg/controller/direct/bigqueryanalyticshub/mapper.go

-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func BigQueryAnalyticsHubDataExchangeSpec_FromProto(mapCtx *direct.MapContext, i
3535
return nil
3636
}
3737
out := &krm.BigQueryAnalyticsHubDataExchangeSpec{}
38-
out.Name = direct.LazyPtr(in.GetName())
3938
out.DisplayName = direct.LazyPtr(in.GetDisplayName())
4039
out.Description = direct.LazyPtr(in.GetDescription())
4140
out.PrimaryContact = direct.LazyPtr(in.GetPrimaryContact())
@@ -52,7 +51,6 @@ func BigQueryAnalyticsHubDataExchangeSpec_ToProto(mapCtx *direct.MapContext, in
5251
}
5352

5453
out := &pb.DataExchange{}
55-
out.Name = direct.ValueOf(in.Name)
5654
out.DisplayName = direct.ValueOf(in.DisplayName)
5755
out.Description = direct.ValueOf(in.Description)
5856
out.PrimaryContact = direct.ValueOf(in.PrimaryContact)
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ kind: BigQueryAnalyticsHubDataExchange
1717
metadata:
1818
name: bigqueryanalyticshubdataexchange${uniqueId}
1919
spec:
20-
description: example data exchange
2120
displayName: my_data_exchange
2221
location: US
2322
projectRef:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1
16+
kind: BigQueryAnalyticsHubDataExchange
17+
metadata:
18+
name: bigqueryanalyticshubdataexchange${uniqueId}
19+
spec:
20+
displayName: my_data_exchange
21+
description: example data exchange
22+
primaryContact: [email protected]
23+
documentation: a documentation
24+
discoveryType: DISCOVERY_TYPE_UNSPECIFIED
25+
location: US
26+
projectRef:
27+
external: ${projectId}
28+
resourceID: bigqueryanalyticshubdataexchange${uniqueId}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
apiVersion: bigqueryanalyticshub.cnrm.cloud.google.com/v1alpha1
16+
kind: BigQueryAnalyticsHubDataExchange
17+
metadata:
18+
name: bigqueryanalyticshubdataexchange${uniqueId}
19+
spec:
20+
displayName: my_data_exchange
21+
description: example data exchange
22+
primaryContact: [email protected]
23+
documentation: an updated documentation
24+
discoveryType: DISCOVERY_TYPE_PRIVATE
25+
location: US
26+
projectRef:
27+
external: ${projectId}
28+
resourceID: bigqueryanalyticshubdataexchange${uniqueId}

0 commit comments

Comments
 (0)