code: func (s *Metric) Validate() error {
  	invalidParams := request.ErrInvalidParams{Context: "Metric"}
  	if s.MetricName != nil && len(*s.MetricName) < 1 {
  		invalidParams.Add(request.NewErrParamMinLen("MetricName", 1))
  	}
  	if s.Namespace != nil && len(*s.Namespace) < 1 {
  		invalidParams.Add(request.NewErrParamMinLen("Namespace", 1))
  	}
  	if s.Dimensions != nil {
  		for i, v := range s.Dimensions {
  			if v == nil {
  				continue
  			}
  			if err := v.Validate(); err != nil {
  				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
  			}
  		}
  	}
  
  	if invalidParams.Len() > 0 {
  		return invalidParams
  	}
  	return nil
  }
docs: // Validate inspects the fields of the type to determine if they are valid.