func GetAssociatedObjectCount(nsId string, resourceType string, resourceId string) (int, error) {

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

	err = common.CheckString(resourceId)
	if err != nil {
		common.CBLog.Error(err)
		return -1, err
	}
	check, err := CheckResource(nsId, resourceType, resourceId)

	if !check {
		errString := "The " + resourceType + " " + resourceId + " does not exist."
		//mapA := map[string]string{"message": errString}
		//mapB, _ := json.Marshal(mapA)
		err := fmt.Errorf(errString)
		return -1, err
	}

	if err != nil {
		common.CBLog.Error(err)
		return -1, err
	}
	fmt.Println("[Get count] " + resourceType + ", " + resourceId)

	key := common.GenResourceKey(nsId, resourceType, resourceId)
	//fmt.Println(key)

	keyValue, err := common.CBStore.Get(key)
	if err != nil {
		common.CBLog.Error(err)
		return -1, err
	}
	if keyValue != nil {
		inUseCount := int(gjson.Get(keyValue.Value, "associatedObjectList.#").Int())
		return inUseCount, nil
	}
	errString := "Cannot get " + resourceType + " " + resourceId + "."
	err = fmt.Errorf(errString)
	return -1, err
}
// GetAssociatedObjectCount returns the number of MCIR's associated Tumblebug objects
GetAssociatedObjectCount returns the number of MCIR's associated Tumblebug objects
// GetAssociatedObjectCount returns the number of MCIR ' s associated Tumblebug objects
func GetAssociatedObjectCount(nsId string, resourceType string, resourceId string) (int, error) {
	err := common.CheckString(nsId)
	if err != nil {
		common.CBLog.Error(err)
		return -1, err
	}
	err = common.CheckString(resourceId)
	if err != nil {
		common.CBLog.Error(err)
		return -1, err
	}
	check, err := CheckResource(nsId, resourceType, resourceId)
	if !check {
		errString := "The " + resourceType + " " + resourceId + " does not exist."
		err := fmt.Errorf(errString)
		return -1, err
	}
	if err != nil {
		common.CBLog.Error(err)
		return -1, err
	}
	fmt.Println("[Get count] " + resourceType + ", " + resourceId)
	key := common.GenResourceKey(nsId, resourceType, resourceId)
	keyValue, err := common.CBStore.Get(key)
	if err != nil {
		common.CBLog.Error(err)
		return -1, err
	}
	if keyValue != nil {
		inUseCount := int(gjson.Get(keyValue.Value, "associatedObjectList.#").Int())
		return inUseCount, nil
	}
	errString := "Cannot get " + resourceType + " " + resourceId + "."
	err = fmt.Errorf(errString)
	return -1, err
}
func GetAssociatedObjectCount ( nsId string , resourceType string , resourceId string ) ( int , error ) { err := common . CheckString ( nsId ) if err != nil { common . CBLog . Error ( err ) return - 1 , err } err = common . CheckString ( resourceId ) if err != nil { common . CBLog . Error ( err ) return - 1 , err } check , err := CheckResource ( nsId , resourceType , resourceId ) if ! check { errString := " " + resourceType + " " + resourceId + " " err := fmt . Errorf ( errString ) return - 1 , err } if err != nil { common . CBLog . Error ( err ) return - 1 , err } fmt . Println ( " " + resourceType + " " + resourceId ) key := common . GenResourceKey ( nsId , resourceType , resourceId ) keyValue , err := common . CBStore . Get ( key ) if err != nil { common . CBLog . Error ( err ) return - 1 , err } if keyValue != nil { inUseCount := int ( gjson . Get ( keyValue . Value , " " ) . Int ( ) ) return inUseCount , nil } errString := " " + resourceType + " " + resourceId + " " err = fmt . Errorf ( errString ) return - 1 , err }
GetAssociatedObjectCount returns the number of MCIR's associated Tumblebug objects
GetAssociatedObjectCount returns the number of MCIR ' s associated Tumblebug objects
//mapA := map[string]string{"message": errString} //mapB, _ := json.Marshal(mapA) //fmt.Println(key)