Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firestore: Add missing fields to Firestore database #15823

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/8909.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
firestore: added `update_time` and `uid` fields to `google_firestore_database` resource
```
28 changes: 26 additions & 2 deletions google/services/firestore/resource_firestore_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ If 'POINT_IN_TIME_RECOVERY_DISABLED' is selected, reads are supported on any ver
"create_time": {
Type: schema.TypeString,
Computed: true,
Description: `The timestamp at which this database was created.`,
Description: `Output only. The timestamp at which this database was created.`,
},
"earliest_version_time": {
Type: schema.TypeString,
Expand All @@ -115,7 +115,7 @@ A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to n
"etag": {
Type: schema.TypeString,
Computed: true,
Description: `This checksum is computed by the server based on the value of other fields,
Description: `Output only. This checksum is computed by the server based on the value of other fields,
and may be sent on update and delete requests to ensure the client has an
up-to-date value before proceeding.`,
},
Expand All @@ -127,6 +127,16 @@ This keyPrefix is used, in combination with the project id ("~") to construct th
that is returned from the Cloud Datastore APIs in Google App Engine first generation runtimes.
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).`,
},
"uid": {
Type: schema.TypeString,
Computed: true,
Description: `Output only. The system-generated UUID4 for this Database.`,
},
"update_time": {
Type: schema.TypeString,
Computed: true,
Description: `Output only. The timestamp at which this database was most recently updated.`,
},
"version_retention_period": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -332,6 +342,12 @@ func resourceFirestoreDatabaseRead(d *schema.ResourceData, meta interface{}) err
if err := d.Set("create_time", flattenFirestoreDatabaseCreateTime(res["create_time"], d, config)); err != nil {
return fmt.Errorf("Error reading Database: %s", err)
}
if err := d.Set("update_time", flattenFirestoreDatabaseUpdateTime(res["update_time"], d, config)); err != nil {
return fmt.Errorf("Error reading Database: %s", err)
}
if err := d.Set("uid", flattenFirestoreDatabaseUid(res["uid"], d, config)); err != nil {
return fmt.Errorf("Error reading Database: %s", err)
}
if err := d.Set("version_retention_period", flattenFirestoreDatabaseVersionRetentionPeriod(res["versionRetentionPeriod"], d, config)); err != nil {
return fmt.Errorf("Error reading Database: %s", err)
}
Expand Down Expand Up @@ -523,6 +539,14 @@ func flattenFirestoreDatabaseCreateTime(v interface{}, d *schema.ResourceData, c
return v
}

func flattenFirestoreDatabaseUpdateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenFirestoreDatabaseUid(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenFirestoreDatabaseVersionRetentionPeriod(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
Expand Down
10 changes: 8 additions & 2 deletions website/docs/r/firestore_database.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,18 @@ In addition to the arguments listed above, the following computed attributes are
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).

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

* `create_time` -
The timestamp at which this database was created.
Output only. The timestamp at which this database was created.

* `update_time` -
Output only. The timestamp at which this database was most recently updated.

* `uid` -
Output only. The system-generated UUID4 for this Database.

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