本文介绍了AWS开发工具包Presigned Post Ruby的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很简单,但是我有这个问题:处理请求时发生意外错误:Aws :: S3:Module的未定义方法'PresignedPost'

It's pretty straightforward but I have this issue:Unexpected error while processing request: undefined method `PresignedPost' for Aws::S3:Module

我的目标:获取可以对其执行上传文件的对象的预签名URL.

My objective: Get the presigned URL for an object to which I can perform an upload file.

我的宝石有

gem 'aws-sdk', '~> 2'

代码:

@@aws_creds = Aws::SharedCredentials.new(profile_name: profile)

Aws.config.update({region: 'us-west-2',credentials: @@aws_creds})
s3 = Aws::S3::Resource.new
@bucket = s3.bucket(bucketName)
form = Aws::S3::PresignedPost(:key => key )
if(form)
  form.fields
end

推荐答案

您通常不做独立的预签名帖子.您可以使用bucket方法进行操作.
类似于@bucket.presigned_post(:key=>key)

you normally don't do a standalone presignedpost. you do it using the bucket method.
something like @bucket.presigned_post(:key=>key)

参见文档: http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/PresignedPost.html

这篇关于AWS开发工具包Presigned Post Ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:37
查看更多