func CheckResource(nsId string, resourceType string, resourceId string) (bool, error) {

	// Check parameters' emptiness
	if nsId == "" {
		err := fmt.Errorf("CheckResource failed; nsId given is null.")
		return false, err
	} else if resourceType == "" {
		err := fmt.Errorf("CheckResource failed; resourceType given is null.")
		return false, err
	} else if resourceId == "" {
		err := fmt.Errorf("CheckResource failed; resourceId given is null.")
		return false, err
	}

	// Check resourceType's validity
	if resourceType == common.StrImage ||
		resourceType == common.StrSSHKey ||
		resourceType == common.StrSpec ||
		resourceType == common.StrVNet ||
		resourceType == common.StrSecurityGroup {
		//resourceType == "subnet" ||
		//resourceType == "publicIp" ||
		//resourceType == "vNic" {
		// continue
	} else {
		err := fmt.Errorf("invalid resource type")
		return false, err
	}

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

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

	fmt.Println("[Check resource] " + resourceType + ", " + resourceId)

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

	keyValue, _ := common.CBStore.Get(key)
	if keyValue != nil {
		return true, nil
	}
	return false, nil

}
// CheckResource returns the existence of the TB MCIR resource in bool form.
CheckResource returns the existence of the TB MCIR resource in bool form.
// CheckResource returns the existence of the TB MCIR resource in bool form .
func CheckResource(nsId string, resourceType string, resourceId string) (bool, error) {
	if nsId == "" {
		err := fmt.Errorf("CheckResource failed; nsId given is null.")
		return false, err
	} else if resourceType == "" {
		err := fmt.Errorf("CheckResource failed; resourceType given is null.")
		return false, err
	} else if resourceId == "" {
		err := fmt.Errorf("CheckResource failed; resourceId given is null.")
		return false, err
	}
	if resourceType == common.StrImage ||
		resourceType == common.StrSSHKey ||
		resourceType == common.StrSpec ||
		resourceType == common.StrVNet ||
		resourceType == common.StrSecurityGroup {
	} else {
		err := fmt.Errorf("invalid resource type")
		return false, err
	}
	err := common.CheckString(nsId)
	if err != nil {
		common.CBLog.Error(err)
		return false, err
	}
	err = common.CheckString(resourceId)
	if err != nil {
		common.CBLog.Error(err)
		return false, err
	}
	fmt.Println("[Check resource] " + resourceType + ", " + resourceId)
	key := common.GenResourceKey(nsId, resourceType, resourceId)
	keyValue, _ := common.CBStore.Get(key)
	if keyValue != nil {
		return true, nil
	}
	return false, nil
}
func CheckResource ( nsId string , resourceType string , resourceId string ) ( bool , error ) { if nsId == " " { err := fmt . Errorf ( " " ) return false , err } else if resourceType == " " { err := fmt . Errorf ( " " ) return false , err } else if resourceId == " " { err := fmt . Errorf ( " " ) return false , err } if resourceType == common . StrImage || resourceType == common . StrSSHKey || resourceType == common . StrSpec || resourceType == common . StrVNet || resourceType == common . StrSecurityGroup { } else { err := fmt . Errorf ( " " ) return false , err } err := common . CheckString ( nsId ) if err != nil { common . CBLog . Error ( err ) return false , err } err = common . CheckString ( resourceId ) if err != nil { common . CBLog . Error ( err ) return false , err } fmt . Println ( " " + resourceType + " " + resourceId ) key := common . GenResourceKey ( nsId , resourceType , resourceId ) keyValue , _ := common . CBStore . Get ( key ) if keyValue != nil { return true , nil } return false , nil }
CheckResource returns the existence of the TB MCIR resource in bool form.
CheckResource returns the existence of the TB MCIR resource in bool form .
// Check parameters' emptiness // Check resourceType's validity //resourceType == "subnet" || //resourceType == "publicIp" || //resourceType == "vNic" { // continue //fmt.Println(key)