ruby-on-rails - 没有 storage.buckets.list 访问 Google Cloud 项目的权限?
问题描述
我编写了一个 Ruby 脚本,它将音频文件上传到 Google Cloud Storage。
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)。
任何帮助,建议?谢谢!
解决方案
推荐阅读
- c - MPI 程序在 MPI_Recv 处挂起
- detox - 排毒测试中是否可能出现循环
- c# - 如何删除工具条之间的水平灰线?
- linux - 期望:检索命令的返回码
- json - 如何在 Windows 中导入 mongodb 转储文件(bson+json)?
- jenkins - 如何使用 Jenkins 自动 svn tag 构建人工制品?
- javascript - Workbox webpack 插件显示离线画面
- amazon-web-services - signtool 无法使用来自 AWS CloudHSM 的密钥对二进制文件进行签名
- openmdao - 将声明的输入变量(全局)连接到 ExecComp
- r - ggplot theme_set() 只能间歇性工作