put_bucket_logging Ruby AWS API因错误而失败您提供的XML格式不正确或未针对我们发布的架构进行验证

时间:2017-02-14 09:14:01

标签: ruby amazon-s3

我正在尝试为put bucket logging实现API调用:

  def put_bucket_logging(log_obj, bucket_name, logging_params)
    log_res = false
    if @session_res == true
      log_obj.info("PUT Bucket logging for bucket : #{bucket_name}")
      begin
        resp = @s3_client.put_bucket_logging({bucket: bucket_name, bucket_logging_status: {logging_enabled: {
             target_grants: [{grantee: {type: logging_params['Type'],},},],},},})

        resp = @s3_client.put_bucket_logging({bucket: bucket_name, bucket_logging_status: {logging_enabled: {target_bucket: logging_params['TargetBucket'],
             target_grants: [{grantee: {display_name: logging_params['DisplayName'], email_address: logging_params['EmailAddress'], id: logging_params['ID'],             type: logging_params['Type'], uri: logging_params['URI'],}, permission: logging_params['Permission'],},],
             target_prefix: logging_params['TargetPrefix'],},},use_accelerate_endpoint: false,})
        log_obj.info(resp)
        log_obj.info("Bucket logging is : #{resp.logging_enabled}")
        log_res = true
     rescue Aws::S3::Errors::ServiceError => e
       log_obj.error("Failed to PUT bucket logging : #{bucket_name} ")
       log_obj.error(e)
       log_res = false
     end
   end

返回log_res   端

失败并显示错误:错误 - :您提供的XML格式不正确或未针对我们发布的架构进行验证(Aws :: S3 :: Errors :: MalformedXML)

0 个答案:

没有答案