Skip to content

Commit fa9fa8f

Browse files
Firestore: Add missing fields to Firestore database (#8909) (#6257)
* Adjust Firestore database etag description * Adjust Firestore database create_time description * Add update_time field to Firestore database * Add uid field to Firestore database Signed-off-by: Modular Magician <[email protected]>
1 parent d61c6be commit fa9fa8f

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

.changelog/8909.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
firestore: added `update_time` and `uid` fields to `google_firestore_database` resource
3+
```

google-beta/services/firestore/resource_firestore_database.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ If 'POINT_IN_TIME_RECOVERY_DISABLED' is selected, reads are supported on any ver
103103
"create_time": {
104104
Type: schema.TypeString,
105105
Computed: true,
106-
Description: `The timestamp at which this database was created.`,
106+
Description: `Output only. The timestamp at which this database was created.`,
107107
},
108108
"earliest_version_time": {
109109
Type: schema.TypeString,
@@ -115,7 +115,7 @@ A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to n
115115
"etag": {
116116
Type: schema.TypeString,
117117
Computed: true,
118-
Description: `This checksum is computed by the server based on the value of other fields,
118+
Description: `Output only. This checksum is computed by the server based on the value of other fields,
119119
and may be sent on update and delete requests to ensure the client has an
120120
up-to-date value before proceeding.`,
121121
},
@@ -127,6 +127,16 @@ This keyPrefix is used, in combination with the project id ("~") to construct th
127127
that is returned from the Cloud Datastore APIs in Google App Engine first generation runtimes.
128128
This value may be empty in which case the appid to use for URL-encoded keys is the project_id (eg: foo instead of v~foo).`,
129129
},
130+
"uid": {
131+
Type: schema.TypeString,
132+
Computed: true,
133+
Description: `Output only. The system-generated UUID4 for this Database.`,
134+
},
135+
"update_time": {
136+
Type: schema.TypeString,
137+
Computed: true,
138+
Description: `Output only. The timestamp at which this database was most recently updated.`,
139+
},
130140
"version_retention_period": {
131141
Type: schema.TypeString,
132142
Computed: true,
@@ -332,6 +342,12 @@ func resourceFirestoreDatabaseRead(d *schema.ResourceData, meta interface{}) err
332342
if err := d.Set("create_time", flattenFirestoreDatabaseCreateTime(res["create_time"], d, config)); err != nil {
333343
return fmt.Errorf("Error reading Database: %s", err)
334344
}
345+
if err := d.Set("update_time", flattenFirestoreDatabaseUpdateTime(res["update_time"], d, config)); err != nil {
346+
return fmt.Errorf("Error reading Database: %s", err)
347+
}
348+
if err := d.Set("uid", flattenFirestoreDatabaseUid(res["uid"], d, config)); err != nil {
349+
return fmt.Errorf("Error reading Database: %s", err)
350+
}
335351
if err := d.Set("version_retention_period", flattenFirestoreDatabaseVersionRetentionPeriod(res["versionRetentionPeriod"], d, config)); err != nil {
336352
return fmt.Errorf("Error reading Database: %s", err)
337353
}
@@ -523,6 +539,14 @@ func flattenFirestoreDatabaseCreateTime(v interface{}, d *schema.ResourceData, c
523539
return v
524540
}
525541

542+
func flattenFirestoreDatabaseUpdateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
543+
return v
544+
}
545+
546+
func flattenFirestoreDatabaseUid(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
547+
return v
548+
}
549+
526550
func flattenFirestoreDatabaseVersionRetentionPeriod(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
527551
return v
528552
}

website/docs/r/firestore_database.html.markdown

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,18 @@ In addition to the arguments listed above, the following computed attributes are
238238
This value may be empty in which case the appid to use for URL-encoded keys is the project_id (eg: foo instead of v~foo).
239239

240240
* `etag` -
241-
This checksum is computed by the server based on the value of other fields,
241+
Output only. This checksum is computed by the server based on the value of other fields,
242242
and may be sent on update and delete requests to ensure the client has an
243243
up-to-date value before proceeding.
244244

245245
* `create_time` -
246-
The timestamp at which this database was created.
246+
Output only. The timestamp at which this database was created.
247+
248+
* `update_time` -
249+
Output only. The timestamp at which this database was most recently updated.
250+
251+
* `uid` -
252+
Output only. The system-generated UUID4 for this Database.
247253

248254
* `version_retention_period` -
249255
Output only. The period during which past versions of data are retained in the database.

0 commit comments

Comments
 (0)