2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
import { arrToObj } from '../utils';
|
|
|
|
|
|
|
|
export default ApplicationSerializer.extend({
|
|
|
|
embed: true,
|
|
|
|
include: ['deploymentTaskGroupSummaries'],
|
|
|
|
|
|
|
|
serialize() {
|
|
|
|
var json = ApplicationSerializer.prototype.serialize.apply(this, arguments);
|
|
|
|
if (json instanceof Array) {
|
|
|
|
json.forEach(serializeDeployment);
|
|
|
|
} else {
|
|
|
|
serializeDeployment(json);
|
|
|
|
}
|
|
|
|
return json;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
function serializeDeployment(deployment) {
|
|
|
|
deployment.TaskGroups = deployment.DeploymentTaskGroupSummaries.reduce(arrToObj('Name'), {});
|
|
|
|
}
|