Skip to content

Commit

Permalink
actually set and read metadata (GoogleCloudPlatform#3458)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilymye authored and Nathan Klish committed May 18, 2020
1 parent edc61d2 commit 973918c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func dataSourceGoogleStorageBucketObjectRead(d *schema.ResourceData, meta interf
d.Set("self_link", res["selfLink"])
d.Set("storage_class", res["storageClass"])
d.Set("md5hash", res["md5Hash"])
d.Set("metadata", res["metadata"])

d.SetId(bucket + "-" + name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ func resourceStorageBucketObjectCreate(d *schema.ResourceData, meta interface{})
object.ContentType = v.(string)
}

if v, ok := d.GetOk("metadata"); ok {
object.Metadata = convertStringMap(v.(map[string]interface{}))
}

if v, ok := d.GetOk("storage_class"); ok {
object.StorageClass = v.(string)
}
Expand Down Expand Up @@ -249,6 +253,7 @@ func resourceStorageBucketObjectRead(d *schema.ResourceData, meta interface{}) e
d.Set("storage_class", res.StorageClass)
d.Set("self_link", res.SelfLink)
d.Set("output_name", res.Name)
d.Set("metadata", res.Metadata)

d.SetId(objectGetId(res))

Expand Down

0 comments on commit 973918c

Please sign in to comment.