Management Pack Builder

 View Only
  • 1.  How to deal better with SubLists

    Posted Sep 29, 2023 11:06 AM

    Hi,

    i'm facing an specific issue very often and i don't know how to handle it.

    Example:

    An API Returns a Array of Objects. Every Object has an SubArray with Objects with IDs id like to us for relationships.

    Example:

    VMware Cloud Director OpenAPI

    GET /cloudapi/1.0.0/vdcGroups (shortened)

    {
    	"values" : [
    		{
    			"id" : "urn:vcloud:vdcGroup:4e6b4c42-1faa-4fea-9180-30293c78a9be",
    			"orgId" : "urn:vcloud:org:b0c84fd0-ccc3-4f46-9378-410fdc8a1892",
    			"name" : "vdcG-O9510FM-imported-1",
    			"participatingOrgVdcs" : [
    				{
    					"vdcRef" : {
    						"name" : "O9510FM_GT02_KEDZI01-01",
    						"id" : "urn:vcloud:vdc:5433db3a-31ab-4ec3-9003-30ac28835934"
    					}
    				},
    				{
    					"vdcRef" : {
    						"name" : "O9510FM_GT02_IMKA002-01",
    						"id" : "urn:vcloud:vdc:5e3baa85-dd25-4d5d-8c81-3231e81334a8"
    					}
    				},
    				{
    					"vdcRef" : {
    						"name" : "O9510FM_GT02_KIRS071-01",
    						"id" : "urn:vcloud:vdc:118b6015-65b5-46e6-a389-2c4f67cb4b17"
    					}
    				},
    				{
    					"vdcRef" : {
    						"name" : "O9510FM_GT02_PETR078-01",
    						"id" : "urn:vcloud:vdc:e74c8e45-37ea-4d33-be67-c7addeae54af"
    					}
    				}
    			]
    		},
    		{
    			"id" : "urn:vcloud:vdcGroup:c769e632-080f-488c-b65b-fa73822aac2b",
    			"orgId" : "urn:vcloud:org:65ce7ee1-a2e0-49d0-b21f-2d86121d6f9a",
    			"name" : "vdcG-O9901SM-vcdNative-01",
    			"participatingOrgVdcs" : [
    				{
    					"vdcRef" : {
    						"name" : "O9901SM_GT02_01",
    						"id" : "urn:vcloud:vdc:f4f9c6a9-db42-46cb-a55d-45ba970ec6a3"
    					}
    				}
    			]
    		}
    	]
    }

    For Every Object in the "values" array i create a new "VDCgroup" object.

    Every orgVDC object i created i'd like to connect to a existing object in Aria as parent.

    The matching attribues is participatingOrgVdcs.vdcRef.id (so a VDCgroup can have multiple childs).

    How can this be archived? I didn't get it...

     

    Kind Regards,

    Marcel



  • 2.  RE: How to deal better with SubLists

    Broadcom Employee
    Posted Sep 29, 2023 05:37 PM

    Hi ,

    There is no way to make relationships based on sub-arrays with MP Builder today. We had it in the roadmap and I've moved it up in priority. Thanks for your detailed example -- it will be a big help in implementing this feature.

    Best regards,

    Mark