// Validate inspects the fields of the type to determine if they are valid.
Validate inspects the fields of the type to determine if they are valid.
// Validate inspects the fields of the type to determine if they are valid .
func (s *CreateComputerInput) Validate() error {
	invalidParams := request.ErrInvalidParams{Context: "CreateComputerInput"}
	if s.ComputerName == nil {
		invalidParams.Add(request.NewErrParamRequired("ComputerName"))
	}
	if s.ComputerName != nil && len(*s.ComputerName) < 1 {
		invalidParams.Add(request.NewErrParamMinLen("ComputerName", 1))
	}
	if s.DirectoryId == nil {
		invalidParams.Add(request.NewErrParamRequired("DirectoryId"))
	}
	if s.OrganizationalUnitDistinguishedName != nil && len(*s.OrganizationalUnitDistinguishedName) < 1 {
		invalidParams.Add(request.NewErrParamMinLen("OrganizationalUnitDistinguishedName", 1))
	}
	if s.Password == nil {
		invalidParams.Add(request.NewErrParamRequired("Password"))
	}
	if s.Password != nil && len(*s.Password) < 8 {
		invalidParams.Add(request.NewErrParamMinLen("Password", 8))
	}
	if s.ComputerAttributes != nil {
		for i, v := range s.ComputerAttributes {
			if v == nil {
				continue
			}
			if err := v.Validate(); err != nil {
				invalidParams.AddNested(fmt.Sprintf("%s[%v]", "ComputerAttributes", i), err.(request.ErrInvalidParams))
			}
		}
	}
	if invalidParams.Len() > 0 {
		return invalidParams
	}
	return nil
}
func ( s * CreateComputerInput ) Validate ( ) error { invalidParams := request . ErrInvalidParams { Context : " " } if s . ComputerName == nil { invalidParams . Add ( request . NewErrParamRequired ( " " ) ) } if s . ComputerName != nil && len ( * s . ComputerName ) < 1 { invalidParams . Add ( request . NewErrParamMinLen ( " " , 1 ) ) } if s . DirectoryId == nil { invalidParams . Add ( request . NewErrParamRequired ( " " ) ) } if s . OrganizationalUnitDistinguishedName != nil && len ( * s . OrganizationalUnitDistinguishedName ) < 1 { invalidParams . Add ( request . NewErrParamMinLen ( " " , 1 ) ) } if s . Password == nil { invalidParams . Add ( request . NewErrParamRequired ( " " ) ) } if s . Password != nil && len ( * s . Password ) < 8 { invalidParams . Add ( request . NewErrParamMinLen ( " " , 8 ) ) } if s . ComputerAttributes != nil { for i , v := range s . ComputerAttributes { if v == nil { continue } if err := v . Validate ( ) ; err != nil { invalidParams . AddNested ( fmt . Sprintf ( " " , " " , i ) , err . ( request . ErrInvalidParams ) ) } } } if invalidParams . Len ( ) > 0 { return invalidParams } return nil }
Validate inspects the fields of the type to determine if they are valid.
Validate inspects the fields of the type to determine if they are valid .