使用AWS SDK for JavaScript设置自动刷新和实现可视化部件自动更新。具体步骤如下:
var params = {
AnalysisId: 'analysis-id',
VersionNumber: 1
};
quicksight.refreshAnalysis(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var params = {
DataSourceId: 'datasource-id',
DataSourceArn: 'arn:...',
AutoCreateTable: false,
SslProperties: {...},
VpcConnectionProperties: {...},
AwsAccountId: 'aws-account-id',
Credentials: {...},
Name: 'datasource-name',
Type: 'datasource-type',
DataSourceParameters: {...},
Schedule: {
Expression: 'cron-expression', // The cron expression consists of six fields separated by white space
DurationInMillis: 3600000, // Refresh interval in milliseconds
},
Status: 'CREATED', // The status can be CREATED, UPDATED, DELETED
};
quicksight.updateDataSource(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
这个例子中,每小时会执行一次刷新操作。您可以使用不同的刷新间隔。