in functions/source/nic-attachment/lib/core/autoscale-handler.js [1204:1555]
async saveSettings(settings) {
let tasks = [],
errorTasks = [];
for (let [key, value] of Object.entries(settings)) {
let keyName = null,
description = null,
jsonEncoded = false,
editable = false;
switch (key.toLowerCase()) {
case 'servicetype':
// ignore service type
break;
case 'deploymentsettingssaved':
keyName = 'deployment-settings-saved';
description =
'A flag setting item that indicates all deployment ' +
'settings have been saved.';
editable = false;
break;
case 'byolscalinggroupdesiredcapacity':
keyName = 'byol-scaling-group-desired-capacity';
description = 'BYOL Scaling group desired capacity.';
editable = true;
break;
case 'byolscalinggroupminsize':
keyName = 'byol-scaling-group-min-size';
description = 'BYOL Scaling group min size.';
editable = true;
break;
case 'byolscalinggroupmaxsize':
keyName = 'byol-scaling-group-max-size';
description = 'BYOL Scaling group max size.';
editable = true;
break;
case 'scalinggroupdesiredcapacity':
keyName = 'scaling-group-desired-capacity';
description = 'PAYG Scaling group desired capacity.';
editable = true;
break;
case 'scalinggroupminsize':
keyName = 'scaling-group-min-size';
description = 'PAYG Scaling group min size.';
editable = true;
break;
case 'scalinggroupmaxsize':
keyName = 'scaling-group-max-size';
description = 'PAYG Scaling group max size.';
editable = true;
break;
case 'resourcetagprefix':
keyName = 'resource-tag-prefix';
description = 'Resource tag prefix.';
editable = false;
break;
case 'customidentifier':
keyName = 'custom-id';
description = 'Custom Identifier.';
editable = false;
break;
case 'uniqueid':
keyName = 'unique-id';
description = 'Unique ID.';
editable = false;
break;
case 'assetstoragename':
keyName = 'asset-storage-name';
description = 'Asset storage name.';
editable = false;
break;
case 'assetstoragekeyprefix':
keyName = 'asset-storage-key-prefix';
description = 'Asset storage key prefix.';
editable = false;
break;
case 'fortigateautoscalevpcid':
keyName = 'fortigate-autoscale-vpc-id';
description = 'VPC ID of the FortiGate Autoscale.';
editable = false;
break;
case 'fortigateautoscalesubnet1':
keyName = 'fortigate-autoscale-subnet-1';
description =
'The ID of the subnet 1 (in the first selected AZ) ' +
'of the FortiGate Autoscale.';
editable = false;
break;
case 'fortigateautoscalesubnet2':
keyName = 'fortigate-autoscale-subnet-2';
description =
'The ID of the subnet 2 (in the second selected AZ) ' +
'of the FortiGate Autoscale.';
editable = false;
break;
case 'fortigateautoscaleprotectedsubnet1':
keyName = 'fortigate-autoscale-protected-subnet1';
description =
'The ID of the protected subnet 1 (in the first selected AZ) ' +
'of the FortiGate Autoscale.';
editable = true;
break;
case 'fortigateautoscaleprotectedsubnet2':
keyName = 'fortigate-autoscale-protected-subnet2';
description =
'The ID of the protected subnet 2 (in the second selected AZ) ' +
'of the FortiGate Autoscale.';
editable = true;
break;
case 'fortigatepsksecret':
keyName = 'fortigate-psk-secret';
description = 'The PSK for FortiGate Autoscale Synchronization.';
break;
case 'fortigateadminport':
keyName = 'fortigate-admin-port';
description = 'The port number for administrative login to FortiGate.';
break;
case 'fortigatetrafficport':
keyName = 'fortigate-traffic-port';
description =
'The port number for load balancer to route traffic through ' +
'FortiGate to the protected services behind the load balancer.';
break;
case 'fortigatesyncinterface':
keyName = 'fortigate-sync-interface';
description =
'The interface the FortiGate uses for configuration ' + 'synchronization.';
editable = true;
break;
case 'lifecyclehooktimeout':
keyName = 'lifecycle-hook-timeout';
description = 'The auto scaling group lifecycle hook timeout time in second.';
editable = true;
break;
case 'heartbeatinterval':
keyName = 'heartbeat-interval';
description = 'The FortiGate sync heartbeat interval in second.';
editable = true;
break;
case 'primaryelectiontimeout':
keyName = 'primary-election-timeout';
description = 'The FortiGate primary election timtout time in second.';
editable = true;
break;
case 'primaryelectionnowait':
keyName = 'primary-election-no-wait';
description =
'Do not wait for the new primary to come up. This FortiGate ' +
'can receive the new primary ip in one of its following heartbeat sync.';
editable = true;
break;
case 'heartbeatlosscount':
keyName = 'heartbeat-loss-count';
description = 'The FortiGate sync heartbeat loss count.';
editable = true;
break;
case 'heartbeatdelayallowance':
keyName = 'heartbeat-delay-allowance';
description = 'The FortiGate sync heartbeat delay allowance time in second.';
editable = true;
break;
case 'autoscalehandlerurl':
keyName = 'autoscale-handler-url';
description = 'The FortiGate Autoscale handler URL.';
editable = false;
break;
case 'primaryscalinggroupname':
keyName = 'primary-scaling-group-name';
description = 'The name of the primary auto scaling group.';
editable = false;
break;
case 'paygscalinggroupname':
keyName = 'payg-scaling-group-name';
description = 'The name of the PAYG auto scaling group.';
editable = false;
break;
case 'byolscalinggroupname':
keyName = 'byol-scaling-group-name';
description = 'The name of the BYOL auto scaling group.';
editable = false;
break;
case 'requiredconfigset':
keyName = 'required-configset';
description = 'A comma-delimited list of required configsets.';
editable = false;
break;
case 'requireddbtable':
keyName = 'required-db-table';
description = 'A comma-delimited list of required DB table names.';
editable = false;
break;
case 'transitgatewayid':
keyName = 'transit-gateway-id';
description =
'The ID of the Transit Gateway the FortiGate Autoscale is ' +
'attached to.';
editable = false;
break;
case 'enabletransitgatewayvpn':
keyName = 'enable-transit-gateway-vpn';
value = value && value !== 'false' ? 'true' : 'false';
description =
'Toggle ON / OFF the Transit Gateway VPN creation on each ' +
'FortiGate instance';
editable = false;
break;
case 'enablesecondnic':
keyName = 'enable-second-nic';
value = value && value !== 'false' ? 'true' : 'false';
description =
'Toggle ON / OFF the secondary eni creation on each ' +
'FortiGate instance';
editable = false;
break;
case 'bgpasn':
keyName = 'bgp-asn';
description =
'The BGP Autonomous System Number of the Customer Gateway ' +
'of each FortiGate instance in the Auto Scaling Group.';
editable = true;
break;
case 'transitgatewayvpnhandlername':
keyName = 'transit-gateway-vpn-handler-name';
description = 'The Transit Gateway VPN handler function name.';
editable = false;
break;
case 'transitgatewayroutetableinbound':
keyName = 'transit-gateway-route-table-inbound';
description = 'The Id of the Transit Gateway inbound route table.';
editable = true;
break;
case 'transitgatewayroutetableoutbound':
keyName = 'transit-gateway-route-table-outbound';
description = 'The Id of the Transit Gateway outbound route table.';
break;
case 'enablehybridlicensing':
keyName = 'enable-hybrid-licensing';
description = 'Toggle ON / OFF the hybrid licensing feature.';
editable = false;
break;
case 'enablefortigateelb':
keyName = 'enable-fortigate-elb';
description =
'Toggle ON / OFF the elastic load balancing for the FortiGate ' +
'scaling groups.';
editable = false;
break;
case 'enableinternalelb':
keyName = 'enable-internal-elb';
description =
'Toggle ON / OFF the internal elastic load balancing for ' +
'the protected services by FortiGate.';
editable = true;
break;
case 'fortigateautoscaleelbdns':
keyName = 'fortigate-autoscale-elb-dns';
description =
'The DNS name of the elastic load balancer for the FortiGate ' +
'scaling groups.';
editable = false;
break;
case 'fortigateautoscaletargetgrouparn':
keyName = 'fortigate-autoscale-target-group-arn';
description =
'The ARN of the target group for FortiGate to receive ' +
'load balanced traffic.';
editable = false;
break;
case 'fortigateprotectedinternalelbdns':
keyName = 'fortigate-protected-internal-elb-dns';
description =
'The DNS name of the elastic load balancer for the scaling ' +
'groups of services protected by FortiGate';
editable = true;
break;
case 'enablevminfocache':
keyName = 'enable-vm-info-cache';
description =
'Toggle ON / OFF the vm info cache feature. It caches the ' +
'vm info in db to reduce API calls to query a vm from the platform.';
editable = true;
break;
case 'vminfocachetime':
keyName = 'vm-info-cache-time';
description = 'The vm info cache time in seconds.';
editable = true;
break;
case 'fortigatelicensestoragekeyprefix':
keyName = 'fortigate-license-storage-key-prefix';
description = 'The key prefix for FortiGate licenses in the access storage.';
editable = true;
break;
case 'getlicensegraceperiod':
keyName = 'get-license-grace-period';
description =
'The period (time in seconds) for preventing a newly assigned ' +
' license to be recycled.';
editable = true;
break;
case 'enablefortianalyzerintegration':
keyName = 'enable-fortianalyzer-integration';
description =
'Enable FortiAnalyzer integration with the FortiGates cluster ' +
'in the Autoscale.';
editable = true;
break;
case 'fazhandlername':
keyName = 'faz-handler-name';
description = 'The FortiGate Autoscale - FortiAnalyzer handler function name.';
editable = true;
break;
case 'enableintegratedegressnatgateway':
keyName = 'enable-integrated-egress-nat-gateway';
description =
'Toggle ON / OFF the feature for using primary FortiGate in' +
' the scaling group as the NAT gateway for egress traffic from protected' +
' private subnets.';
editable = true;
break;
case 'egresstrafficroutetable':
keyName = 'egress-traffic-route-table';
description =
'The route table associated with the protected private subnets,' +
' which should bet configured to contain a route 0.0.0.0/0 to the' +
' primary fortigate to handle egress traffic.';
editable = true;
break;
default:
break;
}
if (keyName) {
tasks.push(
this.platform
.setSettingItem(keyName, value, description, jsonEncoded, editable)
.catch(error => {
this.logger.error(
`failed to save setting for key: ${keyName}. ` +
`Error: ${JSON.stringify(
error instanceof Error
? {
message: error.message,
stack: error.stack
}
: error
)}`
);
errorTasks.push({ key: keyName, value: value });
})
);
}
}
await Promise.all(tasks);
return errorTasks.length === 0;
}