in packages/aws-rfdk/lib/lambdas/nodejs/configure-spot-event-plugin/handler.ts [47:76]
public async doCreate(_physicalId: string, resourceProperties: SEPConfiguratorResourceProps): Promise<object|undefined> {
const spotEventPluginClient = await this.spotEventPluginClient(resourceProperties.connection);
if (!await spotEventPluginClient.addGroups(resourceProperties.deadlineGroups)) {
throw new Error(`Failed to add Deadline group(s) ${resourceProperties.deadlineGroups}`);
}
if (!await spotEventPluginClient.addPools(resourceProperties.deadlinePools)) {
throw new Error(`Failed to add Deadline pool(s) ${resourceProperties.deadlinePools}`);
}
if (resourceProperties.spotFleetRequestConfigurations) {
const convertedSpotFleetRequestConfigs = convertSpotFleetRequestConfiguration(resourceProperties.spotFleetRequestConfigurations);
const stringConfigs = JSON.stringify(convertedSpotFleetRequestConfigs);
const response = await spotEventPluginClient.saveServerData(stringConfigs);
if (!response) {
throw new Error('Failed to save spot fleet request with configuration');
}
}
if (resourceProperties.spotPluginConfigurations) {
const convertedSpotPluginConfigs = convertSpotEventPluginSettings(resourceProperties.spotPluginConfigurations);
const pluginSettings = this.toKeyValueArray(convertedSpotPluginConfigs);
const securitySettings = this.securitySettings();
const response = await spotEventPluginClient.configureSpotEventPlugin([...pluginSettings, ...securitySettings]);
if (!response) {
throw new Error('Failed to save Spot Event Plugin Configurations');
}
}
return undefined;
}