func ListResourceId(nsId string, resourceType string) ([]string, error) {

	err := common.CheckString(nsId)
	if err != nil {
		common.CBLog.Error(err)
		return nil, err
	}

	if resourceType == common.StrImage ||
		resourceType == common.StrSSHKey ||
		resourceType == common.StrSpec ||
		resourceType == common.StrVNet ||
		//resourceType == "subnet" ||
		//resourceType == "publicIp" ||
		//resourceType == "vNic" ||
		resourceType == common.StrSecurityGroup {
		// continue
	} else {
		err = fmt.Errorf("invalid resource type")
		common.CBLog.Error(err)
		return nil, err
	}

	fmt.Println("[ListResourceId] ns: " + nsId + ", type: " + resourceType)
	key := "/ns/" + nsId + "/resources/"
	fmt.Println(key)

	keyValue, _ := common.CBStore.GetList(key, true)

	var resourceList []string
	for _, v := range keyValue {
		trimmedString := strings.TrimPrefix(v.Key, (key + resourceType + "/"))
		// prevent malformed key (if key for resource id includes '/', the key does not represent resource ID)
		if !strings.Contains(trimmedString, "/") {
			resourceList = append(resourceList, trimmedString)
		}
	}
	// for _, v := range resourceList {
	// 	fmt.Println("<" + v + "> \n")
	// }
	// fmt.Println("===============================================")
	return resourceList, nil

}
// ListResourceId returns the list of TB MCIR object IDs of given resourceType
ListResourceId returns the list of TB MCIR object IDs of given resourceType
// ListResourceId returns the list of TB MCIR object IDs of given resourceType
func ListResourceId(nsId string, resourceType string) ([]string, error) {
	err := common.CheckString(nsId)
	if err != nil {
		common.CBLog.Error(err)
		return nil, err
	}
	if resourceType == common.StrImage ||
		resourceType == common.StrSSHKey ||
		resourceType == common.StrSpec ||
		resourceType == common.StrVNet ||
		resourceType == common.StrSecurityGroup {
	} else {
		err = fmt.Errorf("invalid resource type")
		common.CBLog.Error(err)
		return nil, err
	}
	fmt.Println("[ListResourceId] ns: " + nsId + ", type: " + resourceType)
	key := "/ns/" + nsId + "/resources/"
	fmt.Println(key)
	keyValue, _ := common.CBStore.GetList(key, true)
	var resourceList []string
	for _, v := range keyValue {
		trimmedString := strings.TrimPrefix(v.Key, (key + resourceType + "/"))
		if !strings.Contains(trimmedString, "/") {
			resourceList = append(resourceList, trimmedString)
		}
	}
	return resourceList, nil
}
func ListResourceId ( nsId string , resourceType string ) ( [ ] string , error ) { err := common . CheckString ( nsId ) if err != nil { common . CBLog . Error ( err ) return nil , err } if resourceType == common . StrImage || resourceType == common . StrSSHKey || resourceType == common . StrSpec || resourceType == common . StrVNet || resourceType == common . StrSecurityGroup { } else { err = fmt . Errorf ( " " ) common . CBLog . Error ( err ) return nil , err } fmt . Println ( " " + nsId + " " + resourceType ) key := " " + nsId + " " fmt . Println ( key ) keyValue , _ := common . CBStore . GetList ( key , true ) var resourceList [ ] string for _ , v := range keyValue { trimmedString := strings . TrimPrefix ( v . Key , ( key + resourceType + " " ) ) if ! strings . Contains ( trimmedString , " " ) { resourceList = append ( resourceList , trimmedString ) } } return resourceList , nil }
ListResourceId returns the list of TB MCIR object IDs of given resourceType
ListResourceId returns the list of TB MCIR object IDs of given resourceType
//resourceType == "subnet" || //resourceType == "publicIp" || //resourceType == "vNic" || // continue // prevent malformed key (if key for resource id includes '/', the key does not represent resource ID) // for _, v := range resourceList { // 	fmt.Println("<" + v + "> \n") // } // fmt.Println("===============================================")