The CreatorCon Call for Content is officially open! Get started here.

Pratiksha
Mega Sage
Mega Sage
You have to write it on virtual machine instance pattern as extension. Also added xml for ease of use. 
 
 

library {
name = "GET OS"
id = "3d0730798386f1104e2ef355eeaad3cc"
description = "GET OS"

step {
name = "GET OS"

parse_var_to_var {
from_var_name = "rest_resp_instance"
to_var_names = table {
name = "instances"
col_names = "InstanceID", "os"
}

parsing_strategy = xml_parsing_strategy {
rootXpath = "/DescribeInstancesResponse"

fields {
field {
col_name = "InstanceID"
xpath = "/DescribeInstancesResponse/reservationSet/item/instancesSet/item/instanceId/text()"
delimiters = ""
position = 1
}

field {
col_name = "os"
xpath = "/DescribeInstancesResponse/reservationSet/item/instancesSet/item/platformDetails/text()"
delimiters = ""
position = 1
}

field {
col_name = "forEach"
for_each = "forEach"
delimiters = ""
position = 1
}
}
}

if_not_found_do = nop {}
}
}

step {
name = "Remove empty records"

filter {
src_table_name = "instances"
target_table_name = "instances"
condition = is_not_empty {
get_attr { "instances[].InstanceID" }
}
}
}

step {
name = "Set Value"

transform {
src_table_name = "instances"
target_table_name = "cmdb_ci_vm_instance"

operation {
set_field {
field_name = "u_os"
value = get_attr { "instances[].os" }
}

set_field {
field_name = "object_id"
value = get_attr { "instances[].InstanceID" }
}
}
}
}

step {
name = "Dependent relations"

relation_reference {
table1_name = "cmdb_ci_vm_instance"
table2_name = "cmdb_ci_aws_datacenter"
result_table_name = "vm_to_ldc_relation"
unmatched_lines = keep
relation_type = "Hosted on::Hosts"
ref_direction = parentToChild
ref_field_name = ""
}
}
}

 

Do mark it helpful 🙂

 

Regards,

Pratiksha Khandelwal

Version history
Last update:
‎08-17-2025 11:04 PM
Updated by:
Contributors