mirror of https://github.com/rancher/ui.git
depaginate aws roles data
This commit is contained in:
parent
d3ecf2a5d5
commit
be38c1ac79
|
|
@ -604,7 +604,7 @@ export default Component.extend(ClusterDriver, {
|
|||
auth.endpoint = `iam.cn-north-1.amazonaws.com.cn`
|
||||
}
|
||||
|
||||
const awsRoles = await this.describeResource(['IAM', 'listRoles', 'Roles'], {}, auth);
|
||||
const awsRoles = await this.describeResource(['IAM', 'listRoles', 'Roles'], { MaxItems: 1000 }, auth);
|
||||
|
||||
const eksRoles = [];
|
||||
const ec2Roles = []
|
||||
|
|
@ -790,14 +790,28 @@ export default Component.extend(ClusterDriver, {
|
|||
const [awsClassName, awsSDKMethod, responseKey] = apiDescription;
|
||||
const klass = new AWS[awsClassName](authCreds);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
klass[awsSDKMethod](params, (err, data) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
return resolve(data[responseKey]);
|
||||
})
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const fetchData = (params, allResponseData = []) => {
|
||||
klass[awsSDKMethod](params, (err, data) => {
|
||||
if (err){
|
||||
return reject(err)
|
||||
}
|
||||
allResponseData.push(...data[responseKey])
|
||||
|
||||
if (data.IsTruncated && data.Marker){
|
||||
fetchData({
|
||||
...params,
|
||||
Marker: data.Marker
|
||||
}, allResponseData)
|
||||
} else {
|
||||
resolve(allResponseData)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fetchData(params, [])
|
||||
})
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue