Search files in buket with wildcard google cloud storage .net - google-cloud-storage

I have setup cloud storage API in .NET.
I want to search files in the bucket with matched characters as we do
in windows search to find files which contains foo in its name with
any extension we type *foo*.* it will list all files which contains
foo in its name.
can this type of search is supported in google cloud storage with .NET API?

This type of search is not supported by Google Cloud Storage.

Related

KingswaySoft Google Cloud Storage Source component missing parameter

I cant find a solution on how to provide the missing parameter in KingswaySoft Google Cloud Storage Component Editor. Anyone
KingswaySoft Google Cloud Storage Component Editor
KingswaySoft.IntegrationToolkit.GoogleCloudStorage.GoogleCloudStorageServiceException: Non-negative number required.
Parameter name: count (SSIS Productivity Pack, v21.1.0.1551 - DtsDebugHost, v15.0.2000.170)System.ArgumentOutOfRangeException

Change default file/image if not found for public access in Google Cloud Storage

I migrated my website storage to google cloud storage, but the migration/upload was failed for some files because some reasons. By default, if the path/object doesnt exist in the GCS bucket will return XML like below:
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Details>No such object: bucket/the_file.png</Details>
</Error>
Can I change/customize that return to another file/image?
If your static website is online by using a Cloud Storage bucket as is described in this document, you need to upload a public file in your bucket called 404.html, this file must have the html code that you desire to shown when an object doesn't exists.
After uploading the file 404.html it is mandatory to run this command in the cloud shell in order to define the error file
gsutil web set -e 404.html gs://www.example.com
In this page you can find more information about the 404.html file

Get Filepath from uploaded file on Google Cloud Storage

I just configured my application to use Google Cloud Storage for storing user uploads. So far I was able to retrieve the file path of an uploaded by doing so:
ActiveStorage::Blob.service.send(:path_for, file.key)
However, on Google Cloud Storage this gives me the following error:
NoMethodError (undefined method `path_for' for #<ActiveStorage::Service::GCSService:...>)
How can I retrieve the filepath here?
You can use url_for_direct_upload(key, expires_in:, checksum:, **) or url(key, expires_in:, filename:, content_type:, disposition:) to get the GCS urls.
Reference

Use only a domain and disable https://storage.googleapis.com url access

I am newbie at cloud servers and I've opened a google cloud storage to host image files. I've verified my domain and configured it, to view images via my domain. The problem is, same file is both accessible via my domain example.com/images/tiny.png and also via storage.googleapis.com/example.com/images/tiny.png Is there any solution to disable access via storage.googleapis.com and use only my domain?
Google Cloud Platform Support Version:
NOTE: This is the reply from Google Cloud Platform Support when contacted via email...
I understand that you have set up a domain name for one of your Cloud Storage buckets and you want to make sure only URLs starting with your domain name have access to this bucket.
I am afraid that this is not possible because of how Cloud Storage permission works.
Making a Cloud Storage bucket publicly readable also gives each of its files a public link. And currently this public link can’t be disabled.
A workaround would be implement a proxy program and running it on a Compute Engine virtual machine. This VM will need a static external IP so that you can map your domain to it. The proxy program will be in charged of returning the requested file from a predefined Cloud Storage bucket while the bucket keeps to be inaccessible to the public.
You may find these documents helpful if you are interested in this workaround:
1. Quick start to set up a Linux VM (1).
2. Python API for accessing Cloud Storage files (2).
3. How to download service account keys to grant a program access to a set of services (3).
4. Pricing calculator for getting a picture on how much a VM may cost (4).
(1) https://cloud.google.com/compute/docs/quickstart-linux
(2) https://pypi.org/project/google-cloud-storage/
(3) https://cloud.google.com/iam/docs/creating-managing-service-account-keys
(4) https://cloud.google.com/products/calculator/
My Version:
It seems the solution to this question is really a simple, just FUSE Google Cloud Storage with VM Instance.
After FUSE private files from GCS can be accessed through VM's IP address. It made Google Cloud Storage Bucket act like a directory.
The detailed documentation about how to setup FUSE in Google Cloud is here.
There is but it requires you to do more work.
Your current solution works because you've made access to the GCS bucket (example.com), public and then you're DNS aliasing from your domain.
An alternative approach would be for you to limit access to the GCS bucket to one (possibly several) accounts and then run a web-server that uses one of the accounts to access your image files. You could then also either permit access to your web-server to anyone or also limit access to it.
More work for you (and possibly cost) but more control.

Authorizing GCE to Access GCS

I have a django app running in my Google Compute Engine, and it needs to upload video files to my bucket in Google Cloud Storage. When searching for authentication methods, I found this doc. Under Setting the scope of service account access for instances section, it says I need to enable the Cloud Platform access in the settings when creating the VM. I wonder if it is a must and if there's any other way that I can access my cloud storage bucket from my apps in the compute engine. Because creating a new VM and set up the environment is very time-consuming. Any input would be greatly appreciated. Thanks in advance.
As documented on the page you linked to, to authenticate from Google Compute Engine to Google Cloud Storage, you have several options:
Use VM scopes: this must be set before creating the VM, because scopes are immutable once the VM is created. If you want read-only access, you need to add the scope devstorage.read_only (short form) or https://www.googleapis.com/auth/devstorage.read_only (full path). If you want read-write access, you should use the scope devstorage.read_write (short form) or https://www.googleapis.com/auth/devstorage.read_write (full path).
Note: there's also a feature gcloud beta compute instances set-scopes to update GCE VM scopes at runtime.
An alternative to using scopes is to use JSON authentication tokens, such as via Service accounts which can be used by Google API client libraries to connect to Google Cloud Storage.