in source/services/api/admin/lib/admin.js [380:420]
async getAuthorizationDetail(apiKeyId, applicationId) {
const params = {
TableName: process.env.AUTHORIZATIONS_TABLE,
Key: {
api_key_id: apiKeyId,
application_id: applicationId
}
};
const docClient = new AWS.DynamoDB.DocumentClient(this.config);
try {
let data = await docClient.get(params).promise();
if (!_.isEqual(data, {})) {
let result = {
ApiKeyId: data.Item.api_key_id,
ApiKeyName: data.Item.api_key_name,
ApiKeyDescription: data.Item.api_key_description,
ApiKeyValue: data.Item.api_key_value,
ApplicationId: data.Item.application_id,
CreatedAt: data.Item.created_at,
UpdatedAt: data.Item.updated_at,
Enabled: data.Item.enabled
};
return Promise.resolve(result);
} else {
console.log(`MissingAuthorization: Authorization not found`);
return Promise.reject({
code: 404,
error: 'NotFoundException',
message: `Authorization not found`
});
}
} catch (err) {
console.log(JSON.stringify(err));
return Promise.reject({
code: 500,
error: 'InternalFailure',
message: `Error occurred while attempting to retrieve application`
});
}
}