[英]Google Cloud Storage - Rails web app - different buckets and different access keys for different environments
[英]Does not have storage.buckets.list access to the Google Cloud project?
我寫了一個 Ruby 腳本,它將音頻文件上傳到谷歌雲存儲。
def upload_to_Google_cloud(audio_file)
project_id = "<project_id>"
key_file = "<json_file>"
storage = Google::Cloud::Storage.new project: project_id, keyfile: key_file
bucket_name = storage.buckets.first.name
puts bucket_name
bucket = storage.bucket bucket_name
local_file_path = "/path/#{audio_file}"
file = bucket.create_file local_file_path, "#{audio_file}.flac"
return "Uploaded #{file.name}"
end
雖然,每次我運行命令 -> ruby video_dictation.rb 時,它都會返回一個錯誤,即xxxxxxxxx 沒有 storage.buckets.list 訪問 Google Cloud 項目的權限。 (谷歌::雲::PermissionDeniedError) 。
任何幫助,建議? 謝謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.