How to name a servingURL myself?

2019-03-01 03:36发布

I want a servingURL out of a image-file stored in a Google-CS bucket, which is named by myself:

I want to name the servingURL myself. I have a seperate microservice which should define the name of the servingURL. In that case I don't have to make a roundtrip from Google-AE to my microservice since the microservice handles the authorization.

Is there a way to define a servingURL name explicit?

2条回答
对你真心纯属浪费
2楼-- · 2019-03-01 04:05

Don't use a servingURL. Get images directly:

https://storage.googleapis.com/myBucket/avatar.png
https://storage.googleapis.com/myBucket/12345_avatar.png
https://storage.googleapis.com/myBucket/12345/avatar.png

or any other pattern that you use for storing your images.

Then you have no extra roundtrips.

查看更多
成全新的幸福
3楼-- · 2019-03-01 04:06

Not possible when using getServingUrl, no such option in ServingUrlOptions:

https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/images/ServingUrlOptions

However nothing stops you from teaching your microservice to directly serve a GCS file under a custom URL. You might be able to even overlay the regular file access with an image processing library to obtain your own customized image-only serving (micro)service :)

The extra cost would be the associated instance uptime related to actually serving the images. Typically not an issue if your instance(s) stay alive anyways to serve other kinds of traffic.

One thing to consider would be the image download duration exceeding the request deadline. Typically not an issue for small images.

查看更多
登录 后发表回答