//FindStat returns the config of the supplied resource name and type if it exists
FindStat returns the config of the supplied resource name and type if it exists
// FindStat returns the config of the supplied resource name and type if it exists
func (c *NitroClient) FindStat(resourceType string, resourceName string) (map[string]interface{}, error) {
	var data map[string]interface{}
	result, err := c.listStat(resourceType, resourceName)
	if err != nil {
		log.Printf("[WARN] go-nitro: FindStat: No %s %s found", resourceType, resourceName)
		return nil, fmt.Errorf("[INFO] go-nitro: FindStat: No resource %s of type %s found", resourceName, resourceType)
	}
	if err = json.Unmarshal(result, &data); err != nil {
		log.Printf("[ERROR] go-nitro: FindStat: Failed to unmarshal Netscaler Response!")
		return nil, fmt.Errorf("[ERROR] go-nitro: FindStat: Failed to unmarshal Netscaler Response:resource %s of type %s", resourceName, resourceType)
	}
	rsrc, ok := data[resourceType]
	if !ok || rsrc == nil {
		log.Printf("[WARN] go-nitro: FindStat No %s type with name %s found", resourceType, resourceName)
		return nil, fmt.Errorf("[INFO] go-nitro: FindStat: No resource %s of type %s found", resourceName, resourceType)
	}
	resource := data[resourceType].([]interface{})[0] 
	return resource.(map[string]interface{}), nil
}
func ( c * NitroClient ) FindStat ( resourceType string , resourceName string ) ( map [ string ] interface { } , error ) { var data map [ string ] interface { } result , err := c . listStat ( resourceType , resourceName ) if err != nil { log . Printf ( " " , resourceType , resourceName ) return nil , fmt . Errorf ( " " , resourceName , resourceType ) } if err = json . Unmarshal ( result , & data ) ; err != nil { log . Printf ( " " ) return nil , fmt . Errorf ( " " , resourceName , resourceType ) } rsrc , ok := data [ resourceType ] if ! ok || rsrc == nil { log . Printf ( " " , resourceType , resourceName ) return nil , fmt . Errorf ( " " , resourceName , resourceType ) } resource := data [ resourceType ] . ( [ ] interface { } ) [ 0 ] return resource . ( map [ string ] interface { } ) , nil }
FindStat returns the config of the supplied resource name and type if it exists
FindStat returns the config of the supplied resource name and type if it exists
//only one resource obviously