0

我有一个laravel 5.3需要显示aws quicksight图表的项目,我遇到的问题是我不知道如何从 AWS SDK 获取图表嵌入 url。

我在一个lambda-node项目中这样做并且它有效,但在 laravel 中它只是返回{}

这是我的代码,它的响应没有显示任何错误status 200

<?php

namespace App\Http\Controllers;

use Aws\QuickSight\QuickSightClient; 
use Illuminate\Http\Request;
use App\Models\QuicksightDashboard;

class DashboardController extends Controller
{
    //
    public function getDashboard($id) {
        $dashboards = QuicksightDashboard::find($id);
        $quick = new QuickSightClient([
            'version' => 'latest',
            'region'  => 'us-east-1',
            'credentials' => [
              'key'    => '...',
              'secret' => '...',
            ]
        ]);

        $result = $quick->GetDashboardEmbedUrl([
            'AwsAccountId' => '...',
            'DashboardId' => '...',
            'IdentityType' => 'IAM',
            'ResetDisabled' => true,
            'SessionLifetimeInMinutes' => 600,
            'UndoRedoDisabled' => false
        ]);
        return response()->json([
            'code' => 200,
            'message' => 'Operation successfull',
            'dashboard' => $result,
        ]);
    }
}

正如我之前提到的,我传递了正确的凭据和权利accountIddashboardId我还缺少什么?

4

1 回答 1

0

我必须返回我想要它工作的字段。

return $quick->GetDashboardEmbedUrl([
            'AwsAccountId' => '...',
            'DashboardId' => '...',
            'IdentityType' => 'IAM',
            'ResetDisabled' => true,
            'SessionLifetimeInMinutes' => 600,
            'UndoRedoDisabled' => false
        ])->get('EmbedUrl');

这样我就得到了嵌入网址。

于 2020-03-06T12:39:42.340 回答