-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-i3-instances.script
9 lines (6 loc) · 2.18 KB
/
add-i3-instances.script
1
2
3
4
5
6
7
8
9
var dataCenters = new GlideRecord('cmdb_ci_aws_datacenter');
dataCenters.query();
while(dataCenters.next()){
var dataCenterSysID = dataCenters.sys_id.toString();
var inputPayload = '{"items":[{"className":"cmdb_ci_aws_datacenter","values":{"sys_id":"' + dataCenterSysID + '","discovery_source":"ServiceNow"},"lookup":[],"related":[]},{"className":"cmdb_ci_compute_template","values":{"local_storage_gb":"0","discovery_source":"ServiceNow","name":"i3.large","memory_mb":"15.25","vcpus":"2","object_id":"i3.large"},"lookup":[],"related":[]},{"className":"cmdb_ci_compute_template","values":{"local_storage_gb":"0","discovery_source":"ServiceNow","name":"i3.xlarge","memory_mb":"30.5","vcpus":"4","object_id":"i3.xlarge"},"lookup":[],"related":[]},{"className":"cmdb_ci_compute_template","values":{"local_storage_gb":"0","discovery_source":"ServiceNow","name":"i3.2xlarge","memory_mb":"61","vcpus":"8","object_id":"i3.2xlarge"},"lookup":[],"related":[]},{"className":"cmdb_ci_compute_template","values":{"local_storage_gb":"0","discovery_source":"ServiceNow","name":"i3.4xlarge","memory_mb":"122","vcpus":"16","object_id":"i3.4xlarge"},"lookup":[],"related":[]},{"className":"cmdb_ci_compute_template","values":{"local_storage_gb":"0","discovery_source":"ServiceNow","name":"i3.8xlarge","memory_mb":"244","vcpus":"32","object_id":"i3.8xlarge"},"lookup":[],"related":[]},{"className":"cmdb_ci_compute_template","values":{"local_storage_gb":"0","discovery_source":"ServiceNow","name":"i3.16xlarge","memory_mb":"488","vcpus":"64","object_id":"i3.16xlarge"},"lookup":[],"related":[]},{"className":"cmdb_ci_compute_template","values":{"local_storage_gb":"0","discovery_source":"ServiceNow","name":"i3.metal","memory_mb":"512","vcpus":"72","object_id":"i3.metal"},"lookup":[],"related":[]}],"relations":[{"parent":1,"child":0,"type":"Hosted on::Hosts"},{"parent":2,"child":0,"type":"Hosted on::Hosts"},{"parent":3,"child":0,"type":"Hosted on::Hosts"},{"parent":4,"child":0,"type":"Hosted on::Hosts"},{"parent":5,"child":0,"type":"Hosted on::Hosts"},{"parent":6,"child":0,"type":"Hosted on::Hosts"},{"parent":7,"child":0,"type":"Hosted on::Hosts"}]}';
SNC.IdentificationEngineScriptableApi.createOrUpdateCI('ServiceNow',inputPayload); }