Skip to content

Commit

Permalink
Add google_storage_bucket_object.media_link. (#6897)
Browse files Browse the repository at this point in the history
Fixes #6894
  • Loading branch information
iangudger authored Aug 4, 2020
1 parent 67d54b9 commit b589ab1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions google/data_source_google_storage_bucket_object.go
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("media_link", res["mediaLink"])
d.Set("metadata", res["metadata"])

d.SetId(bucket + "-" + name)
Expand Down
7 changes: 7 additions & 0 deletions google/resource_storage_bucket_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ func resourceStorageBucketObject() *schema.Resource {
Computed: true,
Description: `The name of the object. Use this field in interpolations with google_storage_object_acl to recreate google_storage_object_acl resources when your google_storage_bucket_object is recreated.`,
},

"media_link": {
Type: schema.TypeString,
Computed: true,
Description: `A url reference to download this object.`,
},
},
}
}
Expand Down Expand Up @@ -269,6 +275,7 @@ func resourceStorageBucketObjectRead(d *schema.ResourceData, meta interface{}) e
d.Set("self_link", res.SelfLink)
d.Set("output_name", res.Name)
d.Set("metadata", res.Metadata)
d.Set("media_link", res.MediaLink)

d.SetId(objectGetId(res))

Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/storage_bucket_object.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ The following attributes are exported:
* `storage_class` - (Computed) The [StorageClass](https://cloud.google.com/storage/docs/storage-classes) of the new bucket object.
Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`. If not provided, this defaults to the bucket's default
storage class or to a [standard](https://cloud.google.com/storage/docs/storage-classes#standard) class.

* `media_link` - (Computed) A url reference to download this object.
2 changes: 2 additions & 0 deletions website/docs/r/storage_bucket_object.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ exported:

* `output_name` - (Computed) The name of the object. Use this field in interpolations with `google_storage_object_acl` to recreate
`google_storage_object_acl` resources when your `google_storage_bucket_object` is recreated.

* `media_link` - (Computed) A url reference to download this object.

0 comments on commit b589ab1

Please sign in to comment.