From de154da673c61b390bb4d7e319890267e32bef3f Mon Sep 17 00:00:00 2001 From: xiaoweim Date: Thu, 7 Nov 2024 19:35:47 +0000 Subject: [PATCH] Change BigqueryDataset Location to Optional --- apis/bigquery/v1beta1/dataset_reference.go | 22 ++++++------- apis/bigquery/v1beta1/dataset_types.go | 13 +++++--- .../bigquery/v1beta1/zz_generated.deepcopy.go | 10 ++++++ ...tasets.bigquery.cnrm.cloud.google.com.yaml | 18 ++++++++--- .../bigquery/v1beta1/bigquerydataset_types.go | 15 +++++++-- .../bigquery/v1beta1/zz_generated.deepcopy.go | 31 +++++++++++++++++++ .../bigquerydataset_mappings.go | 4 ++- .../bigquerydataset/dataset_controller.go | 15 ++++++++- ..._export_basicbigquerydataset-direct.golden | 2 +- ...ct_basicbigquerydataset-direct.golden.yaml | 5 +-- .../basicbigquerydataset-direct/_http.log | 15 +++++---- .../basicbigquerydataset-direct/create.yaml | 1 - .../basicbigquerydataset-direct/update.yaml | 1 - ...nerated_export_basicbigquerydataset.golden | 2 +- ...ed_object_basicbigquerydataset.golden.yaml | 1 - .../basicbigquerydataset/_http.log | 12 +++---- .../basicbigquerydataset/create.yaml | 1 - .../basicbigquerydataset/update.yaml | 1 - ...querydatasetaccessblock-direct.golden.yaml | 4 ++- ...ct_fullybigquerydataset-direct.golden.yaml | 4 ++- .../resource-docs/bigquery/bigquerydataset.md | 20 ++++++++++-- 21 files changed, 145 insertions(+), 52 deletions(-) diff --git a/apis/bigquery/v1beta1/dataset_reference.go b/apis/bigquery/v1beta1/dataset_reference.go index 27df856488..b4bde3fffc 100644 --- a/apis/bigquery/v1beta1/dataset_reference.go +++ b/apis/bigquery/v1beta1/dataset_reference.go @@ -98,8 +98,7 @@ func NewBigQueryDatasetRef(ctx context.Context, reader client.Reader, obj *BigQu if projectID == "" { return nil, fmt.Errorf("cannot resolve project") } - location := obj.Spec.Location - id.parent = &BigQueryDatasetParent{ProjectID: projectID, Location: valueOf(location)} + id.parent = &BigQueryDatasetParent{ProjectID: projectID} // Get desired ID resourceID := valueOf(obj.Spec.ResourceID) @@ -125,15 +124,15 @@ func NewBigQueryDatasetRef(ctx context.Context, reader client.Reader, obj *BigQu if actualParent.ProjectID != projectID { return nil, fmt.Errorf("spec.projectRef changed, expect %s, got %s", actualParent.ProjectID, projectID) } - if actualParent.Location != valueOf(location) { - return nil, fmt.Errorf("spec.location changed, expect %s, got %s", actualParent.Location, valueOf(location)) - } + // if actualParent.Location != valueOf(location) { + // return nil, fmt.Errorf("spec.location changed, expect %s, got %s", actualParent.Location, valueOf(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) } id.External = externalRef - id.parent = &BigQueryDatasetParent{ProjectID: projectID, Location: valueOf(location)} + id.parent = &BigQueryDatasetParent{ProjectID: projectID} return id, nil } @@ -153,28 +152,27 @@ func (r *BigQueryDatasetRef) Parent() (*BigQueryDatasetParent, error) { type BigQueryDatasetParent struct { ProjectID string - Location string } func (p *BigQueryDatasetParent) String() string { - return "projects/" + p.ProjectID + "/locations/" + p.Location + return "projects/" + p.ProjectID } func asBigQueryDatasetExternal(parent *BigQueryDatasetParent, resourceID string) (external string) { + // Link Reference https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/get return parent.String() + "/datasets/" + resourceID } func ParseBigQueryDatasetExternal(external string) (parent *BigQueryDatasetParent, resourceID string, err error) { external = strings.TrimPrefix(external, "/") tokens := strings.Split(external, "/") - if len(tokens) != 6 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "datasets" { - return nil, "", fmt.Errorf("format of BigQueryDataset external=%q was not known (use projects//locations//datasets/)", external) + if len(tokens) != 4 || tokens[0] != "projects" || tokens[2] != "datasets" { + return nil, "", fmt.Errorf("format of BigQueryDataset external=%q was not known (use projects//datasets/)", external) } parent = &BigQueryDatasetParent{ ProjectID: tokens[1], - Location: tokens[3], } - resourceID = tokens[5] + resourceID = tokens[3] return parent, resourceID, nil } diff --git a/apis/bigquery/v1beta1/dataset_types.go b/apis/bigquery/v1beta1/dataset_types.go index 5555bc2cf4..2c7ba3ec2d 100644 --- a/apis/bigquery/v1beta1/dataset_types.go +++ b/apis/bigquery/v1beta1/dataset_types.go @@ -91,11 +91,10 @@ type BigQueryDatasetSpec struct { // references. IsCaseInsensitive *bool `json:"isCaseInsensitive,omitempty"` - // The geographic location where the dataset should reside. See + // Optional. The geographic location where the dataset should reside. See // https://cloud.google.com/bigquery/docs/locations for supported // locations. - // +required - Location *string `json:"location"` + Location *string `json:"location,omitempty"` // Optional. Defines the time travel window in hours. The value can be from 48 // to 168 hours (2 to 7 days). The default value is 168 hours if this is not @@ -136,11 +135,17 @@ type BigQueryDatasetStatus struct { // Output only. A URL that can be used to access the resource again. You can // use this URL in Get or Update requests to the resource. SelfLink *string `json:"selfLink,omitempty"` + + // ObservedState is the state of the resource as most recently observed in GCP. + ObservedState *BigQueryDatasetObservedState `json:"observedState,omitempty"` } -// BigQueryDatasetSpec defines the desired state of BigQueryDataset +// BigQueryDatasetObservedState defines the desired state of BigQueryDataset // +kcc:proto=google.cloud.bigquery.v2.dataset type BigQueryDatasetObservedState struct { + + // Optional. If the location is not specified in the spec, the GCP server defaults to a location and will be captured here. + Location *string `json:"location,omitempty"` } // +genclient diff --git a/apis/bigquery/v1beta1/zz_generated.deepcopy.go b/apis/bigquery/v1beta1/zz_generated.deepcopy.go index bf12f8e403..81e55103cb 100644 --- a/apis/bigquery/v1beta1/zz_generated.deepcopy.go +++ b/apis/bigquery/v1beta1/zz_generated.deepcopy.go @@ -146,6 +146,11 @@ func (in *BigQueryDatasetList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *BigQueryDatasetObservedState) DeepCopyInto(out *BigQueryDatasetObservedState) { *out = *in + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryDatasetObservedState. @@ -313,6 +318,11 @@ func (in *BigQueryDatasetStatus) DeepCopyInto(out *BigQueryDatasetStatus) { *out = new(string) **out = **in } + if in.ObservedState != nil { + in, out := &in.ObservedState, &out.ObservedState + *out = new(BigQueryDatasetObservedState) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BigQueryDatasetStatus. diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigquerydatasets.bigquery.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigquerydatasets.bigquery.cnrm.cloud.google.com.yaml index ba6d1e1e76..da0b043bbc 100644 --- a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigquerydatasets.bigquery.cnrm.cloud.google.com.yaml +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigquerydatasets.bigquery.cnrm.cloud.google.com.yaml @@ -294,9 +294,9 @@ spec: does not affect routine references. type: boolean location: - description: The geographic location where the dataset should reside. - See https://cloud.google.com/bigquery/docs/locations for supported - locations. + description: Optional. The geographic location where the dataset should + reside. See https://cloud.google.com/bigquery/docs/locations for + supported locations. type: string maxTimeTravelHours: description: Optional. Defines the time travel window in hours. The @@ -342,8 +342,6 @@ spec: storageBillingModel: description: Optional. Updates storage_billing_model for the dataset. type: string - required: - - location type: object status: description: BigQueryDatasetStatus defines the config connector machine @@ -400,6 +398,16 @@ spec: the resource. format: int64 type: integer + observedState: + description: ObservedState is the state of the resource as most recently + observed in GCP. + properties: + location: + description: Optional. If the location is not specified in the + spec, the GCP server defaults to a location and will be captured + here. + type: string + type: object selfLink: description: Output only. A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource. diff --git a/pkg/clients/generated/apis/bigquery/v1beta1/bigquerydataset_types.go b/pkg/clients/generated/apis/bigquery/v1beta1/bigquerydataset_types.go index 24c87195db..6daf84acb5 100644 --- a/pkg/clients/generated/apis/bigquery/v1beta1/bigquerydataset_types.go +++ b/pkg/clients/generated/apis/bigquery/v1beta1/bigquerydataset_types.go @@ -178,8 +178,9 @@ type BigQueryDatasetSpec struct { // +optional IsCaseInsensitive *bool `json:"isCaseInsensitive,omitempty"` - /* The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations. */ - Location string `json:"location"` + /* Optional. The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations. */ + // +optional + Location *string `json:"location,omitempty"` /* Optional. Defines the time travel window in hours. The value can be from 48 to 168 hours (2 to 7 days). The default value is 168 hours if this is not set. */ // +optional @@ -198,6 +199,12 @@ type BigQueryDatasetSpec struct { StorageBillingModel *string `json:"storageBillingModel,omitempty"` } +type DatasetObservedStateStatus struct { + /* Optional. If the location is not specified in the spec, the GCP server defaults to a location and will be captured here. */ + // +optional + Location *string `json:"location,omitempty"` +} + type BigQueryDatasetStatus struct { /* Conditions represent the latest available observations of the BigQueryDataset's current state. */ @@ -222,6 +229,10 @@ type BigQueryDatasetStatus struct { // +optional ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + /* ObservedState is the state of the resource as most recently observed in GCP. */ + // +optional + ObservedState *DatasetObservedStateStatus `json:"observedState,omitempty"` + /* Output only. A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource. */ // +optional SelfLink *string `json:"selfLink,omitempty"` diff --git a/pkg/clients/generated/apis/bigquery/v1beta1/zz_generated.deepcopy.go b/pkg/clients/generated/apis/bigquery/v1beta1/zz_generated.deepcopy.go index c23d48c6fd..b415a9c758 100644 --- a/pkg/clients/generated/apis/bigquery/v1beta1/zz_generated.deepcopy.go +++ b/pkg/clients/generated/apis/bigquery/v1beta1/zz_generated.deepcopy.go @@ -135,6 +135,11 @@ func (in *BigQueryDatasetSpec) DeepCopyInto(out *BigQueryDatasetSpec) { *out = new(bool) **out = **in } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } if in.MaxTimeTravelHours != nil { in, out := &in.MaxTimeTravelHours, &out.MaxTimeTravelHours *out = new(string) @@ -201,6 +206,11 @@ func (in *BigQueryDatasetStatus) DeepCopyInto(out *BigQueryDatasetStatus) { *out = new(int64) **out = **in } + if in.ObservedState != nil { + in, out := &in.ObservedState, &out.ObservedState + *out = new(DatasetObservedStateStatus) + (*in).DeepCopyInto(*out) + } if in.SelfLink != nil { in, out := &in.SelfLink, &out.SelfLink *out = new(string) @@ -858,6 +868,27 @@ func (in *DatasetDefaultEncryptionConfiguration) DeepCopy() *DatasetDefaultEncry return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DatasetObservedStateStatus) DeepCopyInto(out *DatasetObservedStateStatus) { + *out = *in + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatasetObservedStateStatus. +func (in *DatasetObservedStateStatus) DeepCopy() *DatasetObservedStateStatus { + if in == nil { + return nil + } + out := new(DatasetObservedStateStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DatasetRoutine) DeepCopyInto(out *DatasetRoutine) { *out = *in diff --git a/pkg/controller/direct/bigquerydataset/bigquerydataset_mappings.go b/pkg/controller/direct/bigquerydataset/bigquerydataset_mappings.go index 05f6649eda..14f5462b9c 100644 --- a/pkg/controller/direct/bigquerydataset/bigquerydataset_mappings.go +++ b/pkg/controller/direct/bigquerydataset/bigquerydataset_mappings.go @@ -88,9 +88,10 @@ func BigQueryDatasetStatus_FromAPI(mapCtx *direct.MapContext, in *api.Dataset) * out.CreationTime = direct.LazyPtr(in.CreationTime) out.LastModifiedTime = direct.LazyPtr(in.LastModifiedTime) out.SelfLink = direct.LazyPtr(in.SelfLink) + out.ObservedState = &krm.BigQueryDatasetObservedState{Location: direct.LazyPtr(in.Location)} return out } -func BigQueryDatasetStatusObservedState_ToAPI(mapCtx *direct.MapContext, in *krm.BigQueryDatasetStatus) *api.Dataset { +func BigQueryDatasetStatus_ToAPI(mapCtx *direct.MapContext, in *krm.BigQueryDatasetStatus) *api.Dataset { if in == nil { return nil } @@ -99,6 +100,7 @@ func BigQueryDatasetStatusObservedState_ToAPI(mapCtx *direct.MapContext, in *krm out.CreationTime = direct.ValueOf(in.CreationTime) out.LastModifiedTime = direct.ValueOf(in.LastModifiedTime) out.SelfLink = direct.ValueOf(in.SelfLink) + out.Location = direct.ValueOf(in.ObservedState.Location) return out } func Access_ToAPI(mapCtx *direct.MapContext, in *krm.Access) *api.DatasetAccess { diff --git a/pkg/controller/direct/bigquerydataset/dataset_controller.go b/pkg/controller/direct/bigquerydataset/dataset_controller.go index 9b3c36786f..8fd8ac785b 100644 --- a/pkg/controller/direct/bigquerydataset/dataset_controller.go +++ b/pkg/controller/direct/bigquerydataset/dataset_controller.go @@ -184,6 +184,20 @@ func (a *Adapter) Update(ctx context.Context, updateOp *directbase.UpdateOperati resource := clone.Clone(a.actual).(*api.Dataset) + // If the location is not specified upon creation, merge the desired with the previously applied location defaulting. + presviouslyApplied, _, _ := unstructured.NestedMap(u.Object, "status") + if presviouslyApplied != nil { + if presviouslyApplied["observedState"] != nil { + switch observedState := presviouslyApplied["observedState"].(type) { + case map[string]interface{}: + var observed krm.BigQueryDatasetObservedState + if err := runtime.DefaultUnstructuredConverter.FromUnstructured(observedState, &observed); err == nil { + desired.Location = direct.ValueOf(observed.Location) + } + } + } + } + // Check for immutable fields if !reflect.DeepEqual(desired.Location, resource.Location) { return fmt.Errorf("BigQueryDataset %s/%s location cannot be changed, actual: %s, desired: %s", u.GetNamespace(), u.GetName(), resource.Location, desired.Location) @@ -286,7 +300,6 @@ func (a *Adapter) Export(ctx context.Context) (*unstructured.Unstructured, error } obj.Spec.ProjectRef = &refs.ProjectRef{Name: parent.ProjectID} - obj.Spec.Location = &parent.Location uObj, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj) if err != nil { return nil, err diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_export_basicbigquerydataset-direct.golden b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_export_basicbigquerydataset-direct.golden index 6c64b9259f..95391263e2 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_export_basicbigquerydataset-direct.golden +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_export_basicbigquerydataset-direct.golden @@ -18,7 +18,7 @@ spec: - role: WRITER specialGroup: projectWriters friendlyName: bigquerydataset-sample-updated - location: us-central1 + location: US maxTimeTravelHours: "168" projectRef: external: ${projectId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_object_basicbigquerydataset-direct.golden.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_object_basicbigquerydataset-direct.golden.yaml index 34f4f241a1..040a7f0e1f 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_object_basicbigquerydataset-direct.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_generated_object_basicbigquerydataset-direct.golden.yaml @@ -14,7 +14,6 @@ metadata: namespace: ${uniqueId} spec: friendlyName: bigquerydataset-sample-updated - location: us-central1 projectRef: external: ${projectId} status: @@ -26,7 +25,9 @@ status: type: Ready creationTime: "1970-01-01T00:00:00Z" etag: abcdef123456 - externalRef: projects/${projectId}/locations/us-central1/datasets/bigquerydatasetsample${uniqueId} + externalRef: projects/${projectId}/datasets/bigquerydatasetsample${uniqueId} lastModifiedTime: "1970-01-01T00:00:00Z" observedGeneration: 2 + observedState: + location: US selfLink: https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_http.log b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_http.log index 6b3fc1f9c8..e4fc10fab1 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/_http.log @@ -41,8 +41,7 @@ User-Agent: kcc/controller-manager "labels": { "cnrm-test": "true", "managed-by-cnrm": "true" - }, - "location": "us-central1" + } } 200 OK @@ -89,7 +88,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" } @@ -143,7 +142,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "maxTimeTravelHours": "168", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" @@ -188,7 +187,7 @@ User-Agent: kcc/controller-manager "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" } @@ -237,7 +236,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" } @@ -292,7 +291,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "maxTimeTravelHours": "168", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" @@ -347,7 +346,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "maxTimeTravelHours": "168", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/create.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/create.yaml index 8598aa3435..2b41e01f47 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/create.yaml @@ -20,4 +20,3 @@ metadata: alpha.cnrm.cloud.google.com/reconciler: "direct" spec: friendlyName: bigquerydataset-sample - location: us-central1 diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/update.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/update.yaml index c1e87a2805..5d0fdb0cd3 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset-direct/update.yaml @@ -20,4 +20,3 @@ metadata: alpha.cnrm.cloud.google.com/reconciler: "direct" spec: friendlyName: bigquerydataset-sample-updated - location: us-central1 diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_export_basicbigquerydataset.golden b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_export_basicbigquerydataset.golden index 6c64b9259f..95391263e2 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_export_basicbigquerydataset.golden +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_export_basicbigquerydataset.golden @@ -18,7 +18,7 @@ spec: - role: WRITER specialGroup: projectWriters friendlyName: bigquerydataset-sample-updated - location: us-central1 + location: US maxTimeTravelHours: "168" projectRef: external: ${projectId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_object_basicbigquerydataset.golden.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_object_basicbigquerydataset.golden.yaml index e1b26c8300..9ca8d07847 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_object_basicbigquerydataset.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_generated_object_basicbigquerydataset.golden.yaml @@ -14,7 +14,6 @@ metadata: namespace: ${uniqueId} spec: friendlyName: bigquerydataset-sample-updated - location: us-central1 projectRef: external: ${projectId} resourceID: bigquerydatasetsample${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_http.log b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_http.log index 7db6b66ec7..4f53cdab6e 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/_http.log @@ -43,7 +43,7 @@ User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 t "cnrm-test": "true", "managed-by-cnrm": "true" }, - "location": "us-central1" + "location": "US" } 200 OK @@ -90,7 +90,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" } @@ -145,7 +145,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "maxTimeTravelHours": "168", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" @@ -184,7 +184,7 @@ User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 t "cnrm-test": "true", "managed-by-cnrm": "true" }, - "location": "us-central1", + "location": "US", "maxTimeTravelHours": "168" } @@ -232,7 +232,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "maxTimeTravelHours": "168", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" @@ -288,7 +288,7 @@ X-Xss-Protection: 0 "managed-by-cnrm": "true" }, "lastModifiedTime": "123456789", - "location": "us-central1", + "location": "US", "maxTimeTravelHours": "168", "selfLink": "https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydatasetsample${uniqueId}", "type": "DEFAULT" diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/create.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/create.yaml index ad18e71f5a..94f172a61a 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/create.yaml @@ -18,4 +18,3 @@ metadata: name: bigquerydatasetsample${uniqueId} spec: friendlyName: bigquerydataset-sample - location: us-central1 diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/update.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/update.yaml index 461dc1354f..5038f6c984 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/basicbigquerydataset/update.yaml @@ -18,4 +18,3 @@ metadata: name: bigquerydatasetsample${uniqueId} spec: friendlyName: bigquerydataset-sample-updated - location: us-central1 diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/bigquerydatasetaccessblock-direct/_generated_object_bigquerydatasetaccessblock-direct.golden.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/bigquerydatasetaccessblock-direct/_generated_object_bigquerydatasetaccessblock-direct.golden.yaml index 91d9811539..4fc739b17a 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/bigquerydatasetaccessblock-direct/_generated_object_bigquerydatasetaccessblock-direct.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/bigquerydatasetaccessblock-direct/_generated_object_bigquerydatasetaccessblock-direct.golden.yaml @@ -35,7 +35,9 @@ status: type: Ready creationTime: "1970-01-01T00:00:00Z" etag: abcdef123456 - externalRef: projects/${projectId}/locations/US/datasets/bigquerydataset${uniqueId} + externalRef: projects/${projectId}/datasets/bigquerydataset${uniqueId} lastModifiedTime: "1970-01-01T00:00:00Z" observedGeneration: 2 + observedState: + location: US selfLink: https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/fullybigquerydataset-direct/_generated_object_fullybigquerydataset-direct.golden.yaml b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/fullybigquerydataset-direct/_generated_object_fullybigquerydataset-direct.golden.yaml index e717654a27..a6379a2e96 100644 --- a/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/fullybigquerydataset-direct/_generated_object_fullybigquerydataset-direct.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/bigquery/v1beta1/bigquerydataset/fullybigquerydataset-direct/_generated_object_fullybigquerydataset-direct.golden.yaml @@ -43,7 +43,9 @@ status: type: Ready creationTime: "1970-01-01T00:00:00Z" etag: abcdef123456 - externalRef: projects/${projectId}/locations/US/datasets/bigquerydataset${uniqueId} + externalRef: projects/${projectId}/datasets/bigquerydataset${uniqueId} lastModifiedTime: "1970-01-01T00:00:00Z" observedGeneration: 2 + observedState: + location: US selfLink: https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/datasets/bigquerydataset${uniqueId} diff --git a/scripts/generate-google3-docs/resource-reference/generated/resource-docs/bigquery/bigquerydataset.md b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/bigquery/bigquerydataset.md index 793457b24d..f82bcfceb6 100644 --- a/scripts/generate-google3-docs/resource-reference/generated/resource-docs/bigquery/bigquerydataset.md +++ b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/bigquery/bigquerydataset.md @@ -511,11 +511,11 @@ storageBillingModel: string

location

-

Required*

+

Optional

string

-

{% verbatim %}The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations.{% endverbatim %}

+

{% verbatim %}Optional. The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations.{% endverbatim %}

@@ -619,6 +619,8 @@ etag: string externalRef: string lastModifiedTime: integer observedGeneration: integer +observedState: + location: string selfLink: string ``` @@ -713,6 +715,20 @@ selfLink: string

{% 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.location + +

string

+

{% verbatim %}Optional. If the location is not specified in the spec, the GCP server defaults to a location and will be captured here.{% endverbatim %}

+ + selfLink